* git diff-index --raw HEAD and git diff --raw HEAD output the same thing? @ 2008-03-01 13:10 Ping Yin 2008-03-01 13:21 ` Johannes Schindelin 2008-03-02 5:24 ` Ping Yin 0 siblings, 2 replies; 6+ messages in thread From: Ping Yin @ 2008-03-01 13:10 UTC (permalink / raw) To: Git Mailing List Does these two commands output the same content except displaying format? Follwoing is my test $ git diff-index --raw HEAD :160000 000000 ad1e416e87dc02617de68c41bb18e5abf0e24729 0000000000000000000000000000000000000000 D WordBreak :160000 160000 34f279b1662a6bef6a8fdea1827bbdbd80f12444 0000000000000000000000000000000000000000 M commonmake :160000 100644 c517f783d9efb5a8d24f80fb67f644a39afec2a6 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 T util $ git diff --raw HEAD :160000 000000 ad1e416e87dc02617de68c41bb18e5abf0e24729 0000000... D WordBreak :160000 160000 34f279b1662a6bef6a8fdea1827bbdbd80f12444 c1f46b3f10cc041e196c388490ddb049dacc7dc0 M commonmake :160000 100644 c517f783d9efb5a8d24f80fb67f644a39afec2a6 e69de29... T util Strange things is this line :160000 160000 34f279b1662a6bef6a8fdea1827bbdbd80f12444 0000000000000000000000000000000000000000 M commonmake why mod is 160000 while sha1 is 0000... -- Ping Yin ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: git diff-index --raw HEAD and git diff --raw HEAD output the same thing? 2008-03-01 13:10 git diff-index --raw HEAD and git diff --raw HEAD output the same thing? Ping Yin @ 2008-03-01 13:21 ` Johannes Schindelin [not found] ` <46dff0320803010545n775f1441x579a53a8c07d0892@mail.gmail.com> 2008-03-02 5:48 ` Junio C Hamano 2008-03-02 5:24 ` Ping Yin 1 sibling, 2 replies; 6+ messages in thread From: Johannes Schindelin @ 2008-03-01 13:21 UTC (permalink / raw) To: Ping Yin; +Cc: Git Mailing List Hi, On Sat, 1 Mar 2008, Ping Yin wrote: > Strange things is this line > :160000 160000 34f279b1662a6bef6a8fdea1827bbdbd80f12444 > 0000000000000000000000000000000000000000 M commonmake > > why mod is 160000 while sha1 is 0000... This indicates that a submodule (160000) was deleted (00000). It is easier not to handle a deletion as mode change... Ciao, Dscho ^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <46dff0320803010545n775f1441x579a53a8c07d0892@mail.gmail.com>]
* Fwd: git diff-index --raw HEAD and git diff --raw HEAD output the same thing? [not found] ` <46dff0320803010545n775f1441x579a53a8c07d0892@mail.gmail.com> @ 2008-03-02 5:22 ` Ping Yin 0 siblings, 0 replies; 6+ messages in thread From: Ping Yin @ 2008-03-02 5:22 UTC (permalink / raw) To: Git Mailing List Sorry i have forgotten to cc git list ---------- Forwarded message ---------- From: Ping Yin <pkufranky@gmail.com> Date: Sat, Mar 1, 2008 at 9:45 PM Subject: Re: git diff-index --raw HEAD and git diff --raw HEAD output the same thing? To: Johannes Schindelin <Johannes.Schindelin@gmx.de> On Sat, Mar 1, 2008 at 9:21 PM, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote: > Hi, > > > On Sat, 1 Mar 2008, Ping Yin wrote: > > > Strange things is this line > > :160000 160000 34f279b1662a6bef6a8fdea1827bbdbd80f12444 > > 0000000000000000000000000000000000000000 M commonmake > > > > why mod is 160000 while sha1 is 0000... > > This indicates that a submodule (160000) was deleted (00000). It is > easier not to handle a deletion as mode change... > No, it isn't deleted, git diff --raw HEAD shows the right result And why do diff and diff-index show different result? $ git status # On branch master # Changes to be committed: # (use "git reset HEAD <file>..." to unstage) # # deleted: WordBreak # typechange: util # # Changed but not updated: # (use "git add <file>..." to update what will be committed) # # modified: commonmake > Ciao, > Dscho > > -- Ping Yin ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: git diff-index --raw HEAD and git diff --raw HEAD output the same thing? 2008-03-01 13:21 ` Johannes Schindelin [not found] ` <46dff0320803010545n775f1441x579a53a8c07d0892@mail.gmail.com> @ 2008-03-02 5:48 ` Junio C Hamano 2008-03-02 6:07 ` Ping Yin 1 sibling, 1 reply; 6+ messages in thread From: Junio C Hamano @ 2008-03-02 5:48 UTC (permalink / raw) To: Johannes Schindelin; +Cc: Ping Yin, Git Mailing List Johannes Schindelin <Johannes.Schindelin@gmx.de> writes: > On Sat, 1 Mar 2008, Ping Yin wrote: > >> Strange things is this line >> :160000 160000 34f279b1662a6bef6a8fdea1827bbdbd80f12444 >> 0000000000000000000000000000000000000000 M commonmake >> >> why mod is 160000 while sha1 is 0000... > > This indicates that a submodule (160000) was deleted (00000). It is > easier not to handle a deletion as mode change... Read the question again. When you compare something with a work tree state, and when the work tree state is dirty, we always show 0{40} to mean "it is dirty and we do not know what the object name of that thing is, until you actuallly run git-update-index (or git-add) it" (and at that point it would stop being dirty). For blobs (be it a regular file or a symbolic link), this has an advantage of not having to run hash-object to obtain the object name of an object that would be created if you actually did git-add it. When we check if it is dirty, we already do an lstat(2) and know the type of it, so we can show the mode bits. So you will see 100644, 100755 or 120000 for blobs. Similarly for a submodule. For a submodule, we could read the value from $sub/.git/HEAD, but it is more consistent to show 0{40} on the work tree side (typically the right hand side, unless you use -R). ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: git diff-index --raw HEAD and git diff --raw HEAD output the same thing? 2008-03-02 5:48 ` Junio C Hamano @ 2008-03-02 6:07 ` Ping Yin 0 siblings, 0 replies; 6+ messages in thread From: Ping Yin @ 2008-03-02 6:07 UTC (permalink / raw) To: Junio C Hamano; +Cc: Johannes Schindelin, Git Mailing List On Sun, Mar 2, 2008 at 1:48 PM, Junio C Hamano <gitster@pobox.com> wrote: > > Johannes Schindelin <Johannes.Schindelin@gmx.de> writes: > > > On Sat, 1 Mar 2008, Ping Yin wrote: > > > >> Strange things is this line > >> :160000 160000 34f279b1662a6bef6a8fdea1827bbdbd80f12444 > >> 0000000000000000000000000000000000000000 M commonmake > >> > >> why mod is 160000 while sha1 is 0000... > > > > This indicates that a submodule (160000) was deleted (00000). It is > > easier not to handle a deletion as mode change... > > Read the question again. > > When you compare something with a work tree state, and when the work tree > state is dirty, we always show 0{40} to mean "it is dirty and we do not > know what the object name of that thing is, until you actuallly run > git-update-index (or git-add) it" (and at that point it would stop being > dirty). For blobs (be it a regular file or a symbolic link), this has an > advantage of not having to run hash-object to obtain the object name of an > object that would be created if you actually did git-add it. > > When we check if it is dirty, we already do an lstat(2) and know the type > of it, so we can show the mode bits. So you will see 100644, 100755 or > 120000 for blobs. Similarly for a submodule. > > For a submodule, we could read the value from $sub/.git/HEAD, but it is > more consistent to show 0{40} on the work tree side (typically the right > hand side, unless you use -R). > I should read the git-diff/git-diff-index man pages more carefully. It says "<sha1> is shown as all 0's if a file is new on the filesystem and it is out of sync with the index" But unlike git-diff-index, git-diff does the right thing for me $ git diff --raw HEAD :160000 160000 34f279b1662a6bef6a8fdea1827bbdbd80f12444 c1f46b3f10cc041e196c388490ddb049dacc7dc0 M commonmake while git diff-index desn't $ git diff-index --raw HEAD :160000 160000 34f279b1662a6bef6a8fdea1827bbdbd80f12444 0000000000000000000000000000000000000000 M commonmake Maybe the man page should clarify the different behaviour of git-diff. I really want the real sha1 instead of 0{40} in my submodule summary patch, or i have to use git-diff instead of git-diff-index -- Ping Yin ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: git diff-index --raw HEAD and git diff --raw HEAD output the same thing? 2008-03-01 13:10 git diff-index --raw HEAD and git diff --raw HEAD output the same thing? Ping Yin 2008-03-01 13:21 ` Johannes Schindelin @ 2008-03-02 5:24 ` Ping Yin 1 sibling, 0 replies; 6+ messages in thread From: Ping Yin @ 2008-03-02 5:24 UTC (permalink / raw) To: Git Mailing List On Sat, Mar 1, 2008 at 9:10 PM, Ping Yin <pkufranky@gmail.com> wrote: > Does these two commands output the same content except displaying format? > > Follwoing is my test > > $ git diff-index --raw HEAD > :160000 000000 ad1e416e87dc02617de68c41bb18e5abf0e24729 > 0000000000000000000000000000000000000000 D WordBreak > :160000 160000 34f279b1662a6bef6a8fdea1827bbdbd80f12444 > 0000000000000000000000000000000000000000 M commonmake > :160000 100644 c517f783d9efb5a8d24f80fb67f644a39afec2a6 > e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 T util > > $ git diff --raw HEAD > :160000 000000 ad1e416e87dc02617de68c41bb18e5abf0e24729 0000000... D > WordBreak > :160000 160000 34f279b1662a6bef6a8fdea1827bbdbd80f12444 > c1f46b3f10cc041e196c388490ddb049dacc7dc0 M commonmake > :160000 100644 c517f783d9efb5a8d24f80fb67f644a39afec2a6 e69de29... T util > > Strange things is this line > :160000 160000 34f279b1662a6bef6a8fdea1827bbdbd80f12444 > 0000000000000000000000000000000000000000 M commonmake > > why mod is 160000 while sha1 is 0000... > > -- > Ping Yin > Any more response? Is this a bug or my misunderstanding? -- Ping Yin ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2008-03-02 6:08 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2008-03-01 13:10 git diff-index --raw HEAD and git diff --raw HEAD output the same thing? Ping Yin 2008-03-01 13:21 ` Johannes Schindelin [not found] ` <46dff0320803010545n775f1441x579a53a8c07d0892@mail.gmail.com> 2008-03-02 5:22 ` Fwd: " Ping Yin 2008-03-02 5:48 ` Junio C Hamano 2008-03-02 6:07 ` Ping Yin 2008-03-02 5:24 ` Ping Yin
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).