All of lore.kernel.org
 help / color / mirror / Atom feed
* Bug in 2.26.2 regading "git diff --cached"?
@ 2022-04-20 11:24 Ulrich Windl
  2022-04-20 11:31 ` Antw: " Ulrich Windl
  0 siblings, 1 reply; 2+ messages in thread
From: Ulrich Windl @ 2022-04-20 11:24 UTC (permalink / raw)
  To: git

Hi!

I just added interactively one hunk and committed it, just to find out that I wanted to include another hunk (that would need editing).
So I reset to the previous commit, added the two correct hunks again, and then did "git diff --cached".
I was surprised to find only one of the two hunks I've added in the diff.
The likely reason is that one of thoise hunks had been committed, but that commit was reset.

Some details:
(reflog)
ebd6e6c (HEAD -> rfc-5424-message) HEAD@{0}: reset: moving to ebd6e6c8af5b9eaa809a114ee6a972114b3f6a86
6997ce5 HEAD@{1}: commit: Remove call to Class::_fake_load(__PACKAGE__)
ebd6e6c (HEAD -> rfc-5424-message) HEAD@{2}: commit: Fix RE_day in lib/RFC_5424_Message.pm

So 6997ce5 was the incomplete commit.

> git status
On branch rfc-5424-message
Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
        modified:   lib/Message.pm
        modified:   lib/UnknownMessage.pm

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        modified:   lib/Message.pm
        modified:   lib/MessageLogFormat.pm
        modified:   lib/RFC_3164_Message.pm
        modified:   lib/RFC_5424_Message.pm
        modified:   syslogd.pl

So there are two files with changes to commit.
"git diff --cached -M" outputs only one chink, however:
diff --git a/lib/UnknownMessage.pm b/lib/UnknownMessage.pm
index eef8f25..d0246ef 100644
--- a/lib/UnknownMessage.pm
+++ b/lib/UnknownMessage.pm
@@ -114,8 +114,4 @@ sub parse_OK($$$$)
     return defined($class->new_parsed($lt, $peer_addr, $packet, 1));
 }

-BEGIN {
-    Class::_fake_load(__PACKAGE__);    # Tell Perl module is loaded already
-}
-
 1;
---------------
Interestingly the hunk shown is the one that was in the bad commit; the edited commit is missing.

The missing hunk should look like this:
---
diff --git a/lib/Message.pm b/lib/Message.pm
index 2c60960..abd3e8e 100644
--- a/lib/Message.pm
+++ b/lib/Message.pm
@@ -147,8 +147,19 @@ sub parse_OK($$$$)
     return undef;
 }

-BEGIN {
-    Class::_fake_load(__PACKAGE__);    # Tell Perl module is loaded already
-}

 1;
---

Now is that a bug, or is it a "pilot error"?

Regards,
Ulrich




^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Antw: Bug in 2.26.2 regading "git diff --cached"?
  2022-04-20 11:24 Bug in 2.26.2 regading "git diff --cached"? Ulrich Windl
@ 2022-04-20 11:31 ` Ulrich Windl
  0 siblings, 0 replies; 2+ messages in thread
From: Ulrich Windl @ 2022-04-20 11:31 UTC (permalink / raw)
  To: git

Hi again!

It seems the issue was caused by the specific edit of the hunk.
I cannot remember that there was an error message, but I reset the adds again and re-edited the hunk.
This time the "diff --cached" showed the change for both files.

Regards,
Ulrich

>>> Ulrich Windl schrieb am 20.04.2022 um 13:24 in Nachricht <625FED5E.C7A : 161 :
60728>:
> Hi!
> 
> I just added interactively one hunk and committed it, just to find out that 
> I wanted to include another hunk (that would need editing).
> So I reset to the previous commit, added the two correct hunks again, and 
> then did "git diff --cached".
> I was surprised to find only one of the two hunks I've added in the diff.
> The likely reason is that one of thoise hunks had been committed, but that 
> commit was reset.
> 
> Some details:
> (reflog)
> ebd6e6c (HEAD -> rfc-5424-message) HEAD@{0}: reset: moving to 
> ebd6e6c8af5b9eaa809a114ee6a972114b3f6a86
> 6997ce5 HEAD@{1}: commit: Remove call to Class::_fake_load(__PACKAGE__)
> ebd6e6c (HEAD -> rfc-5424-message) HEAD@{2}: commit: Fix RE_day in 
> lib/RFC_5424_Message.pm
> 
> So 6997ce5 was the incomplete commit.
> 
> > git status
> On branch rfc-5424-message
> Changes to be committed:
>   (use "git restore --staged <file>..." to unstage)
>         modified:   lib/Message.pm
>         modified:   lib/UnknownMessage.pm
> 
> Changes not staged for commit:
>   (use "git add <file>..." to update what will be committed)
>   (use "git restore <file>..." to discard changes in working directory)
>         modified:   lib/Message.pm
>         modified:   lib/MessageLogFormat.pm
>         modified:   lib/RFC_3164_Message.pm
>         modified:   lib/RFC_5424_Message.pm
>         modified:   syslogd.pl
> 
> So there are two files with changes to commit.
> "git diff --cached -M" outputs only one chink, however:
> diff --git a/lib/UnknownMessage.pm b/lib/UnknownMessage.pm
> index eef8f25..d0246ef 100644
> --- a/lib/UnknownMessage.pm
> +++ b/lib/UnknownMessage.pm
> @@ -114,8 +114,4 @@ sub parse_OK($$$$)
>      return defined($class->new_parsed($lt, $peer_addr, $packet, 1));
>  }
> 
> -BEGIN {
> -    Class::_fake_load(__PACKAGE__);    # Tell Perl module is loaded already
> -}
> -
>  1;
> ---------------
> Interestingly the hunk shown is the one that was in the bad commit; the 
> edited commit is missing.
> 
> The missing hunk should look like this:
> ---
> diff --git a/lib/Message.pm b/lib/Message.pm
> index 2c60960..abd3e8e 100644
> --- a/lib/Message.pm
> +++ b/lib/Message.pm
> @@ -147,8 +147,19 @@ sub parse_OK($$$$)
>      return undef;
>  }
> 
> -BEGIN {
> -    Class::_fake_load(__PACKAGE__);    # Tell Perl module is loaded already
> -}
> 
>  1;
> ---
> 
> Now is that a bug, or is it a "pilot error"?
> 
> Regards,
> Ulrich
> 
> 
> 





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-04-20 11:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-20 11:24 Bug in 2.26.2 regading "git diff --cached"? Ulrich Windl
2022-04-20 11:31 ` Antw: " Ulrich Windl

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.