threads / discuss / 26729

'typechange' in the git-status output

Subject: 'typechange' in the git-status output

## tl;dr

7 messages between Mar 14, 2011 and Mar 14, 2011.

replies: 6people: 5as markdown or json

Alexei Sholik· Mar 14, 2011, 18:29 UTC · lore
Hi git,

I cloned git mirror from github[1]. When I run git-status in it's working directory, I see no output.

But then, after copying the whole directory with 'cp -r' and running git-status in the newly created directory, I get the following:

Show 6 quoted lines
> # On branch master
> # Changed but not updated:
> #   (use "git add <file>..." to update what will be committed)
> #   (use "git checkout -- <file>..." to discard changes in working directory)
> #
> #	typechange: RelNotes
git-diff shows
Show 6 quoted lines
> diff --git a/RelNotes b/RelNotes
> new file mode 100644
> index 0000000..56c3863
> --- /dev/null
> +++ b/RelNotes
> ... // the whole contents of the file

Both copies of the repository are on the branch master with the latest commit 07873dc. Simply diffing copies of the RelNotes file gives no output.

What happened with the copied repository? I've found a couple of instances of the word 'typechange' in the source, but no mention in the docs. What does it mean and what could be the cause of this change?

  [1]: git://github.com/git/git.git
-- 
Best regards,
Alexei Sholik
Jeff King· Mar 14, 2011, 18:39 UTC · re: Alexei Sholik · lore

Re: 'typechange' in the git-status output

On Mon, Mar 14, 2011 at 08:29:57PM +0200, Alexei Sholik wrote:
> But then, after copying the whole directory with 'cp -r' and running
> git-status in the newly created directory, I get the following:

"cp -r" isn't an exact copy. You probably want "cp -a" or at least "cp -rs".

Show 6 quoted lines
> > # On branch master
> > # Changed but not updated:
> > #   (use "git add <file>..." to update what will be committed)
> > #   (use "git checkout -- <file>..." to discard changes in working directory)
> > #
> > #	typechange: RelNotes

Right. RelNotes is a symlink. But "cp -r" dereferences the symlink and copies the file contents themselves.

> What happened with the copied repository? I've found a couple of
> instances of the word 'typechange' in the source, but no mention in
> the docs. What does it mean and what could be the cause of this
> change?

It's the same as the "T" flag in "git diff --name-status". Namely, the type of the file changed (between a symlink and a regular file).

-Peff
Alexei Sholik· Mar 14, 2011, 18:39 UTC · re: Alexei Sholik · lore

Re: 'typechange' in the git-status output

On 14 March 2011 20:29, Alexei Sholik <alcosholik@gmail.com> wrote:
Show 40 quoted lines
> Hi git,
>
> I cloned git mirror from github[1]. When I run git-status in it's
> working directory, I see no output.
>
> But then, after copying the whole directory with 'cp -r' and running
> git-status in the newly created directory, I get the following:
>
>> # On branch master
>> # Changed but not updated:
>> #   (use "git add <file>..." to update what will be committed)
>> #   (use "git checkout -- <file>..." to discard changes in working directory)
>> #
>> #     typechange: RelNotes
>
> git-diff shows
>
>> diff --git a/RelNotes b/RelNotes
>> new file mode 100644
>> index 0000000..56c3863
>> --- /dev/null
>> +++ b/RelNotes
>> ... // the whole contents of the file
>
> Both copies of the repository are on the branch master with the latest
> commit 07873dc. Simply diffing copies of the RelNotes file gives no
> output.
>
> What happened with the copied repository? I've found a couple of
> instances of the word 'typechange' in the source, but no mention in
> the docs. What does it mean and what could be the cause of this
> change?
>
>
>  [1]: git://github.com/git/git.git
>
> --
> Best regards,
> Alexei Sholik
>
Right, I've figured out the root of the change.
'ls -l' on the original RelNotes outputs:
  lrwxr-xr-x  1 alco  staff  32 Mar 14 20:35 RelNotes ->
Documentation/RelNotes/1.7.5.txt
'ls -l' on the copied RelNotes outputs:
  -rw-r--r--  1 alco  staff  1810 Mar 14 20:10 RelNotes

So the problem is with the cp, not git. But I wonder if it is mentioned anywhere in the docs? Probably, git-clone's or git-status' manpage would be a proper place?

-- 
Best regards,
Alexei Sholik
Drew Northup· Mar 14, 2011, 18:59 UTC · re: Alexei Sholik · lore

Re: 'typechange' in the git-status output

On Mon, 2011-03-14 at 20:39 +0200, Alexei Sholik wrote:
Show 8 quoted lines
> On 14 March 2011 20:29, Alexei Sholik <alcosholik@gmail.com> wrote:
> > Hi git,
> >
> > I cloned git mirror from github[1]. When I run git-status in it's
> > working directory, I see no output.
> >
> > But then, after copying the whole directory with 'cp -r' and running
> > git-status in the newly created directory, I get the following:
Show 12 quoted lines
> Right, I've figured out the root of the change.
> 
> 'ls -l' on the original RelNotes outputs:
>   lrwxr-xr-x  1 alco  staff  32 Mar 14 20:35 RelNotes ->
> Documentation/RelNotes/1.7.5.txt
> 
> 'ls -l' on the copied RelNotes outputs:
>   -rw-r--r--  1 alco  staff  1810 Mar 14 20:10 RelNotes
> 
> So the problem is with the cp, not git. But I wonder if it is
> mentioned anywhere in the docs? Probably, git-clone's or git-status'
> manpage would be a proper place?
Quoting Jeff King <peff@peff.net>:
> "cp -r" isn't an exact copy. You probably want "cp -a" or at least "cp
> -rs".
.....
> Right. RelNotes is a symlink. But "cp -r" dereferences the symlink and
> copies the file contents themselves.

As has been said more than a few times (and is probably somewhere in the docs), if you really want to duplicate a git repo you should probably be using git to do it. No change to the manpages is required here.

-- 
-Drew Northup
________________________________________________
"As opposed to vegetable or mineral error?"
-John Pescatore, SANS NewsBites Vol. 12 Num. 59
Jonathan Nieder· Mar 14, 2011, 19:22 UTC · re: Drew Northup · lore

Re: 'typechange' in the git-status output

Hi,
Drew Northup wrote:
> As has been said more than a few times (and is probably somewhere in the
> docs), if you really want to duplicate a git repo you should probably be
> using git to do it.

FWIW I don't agree with this advice. "cp -a" works perfectly well and I think that's a valuable thing.

On the other hand, if you want to _back up_ or sneakernet a git repo, I agree that "git bundle create /path/to/backup.bundle --all" is better.

Perhaps the user manual could explain this somewhere.

Hope that helps, Jonathan

Jeff King· Mar 14, 2011, 19:27 UTC · re: Jonathan Nieder · lore

Re: 'typechange' in the git-status output

On Mon, Mar 14, 2011 at 02:22:38PM -0500, Jonathan Nieder wrote:
Show 10 quoted lines
> Hi,
> 
> Drew Northup wrote:
> 
> > As has been said more than a few times (and is probably somewhere in the
> > docs), if you really want to duplicate a git repo you should probably be
> > using git to do it.
> 
> FWIW I don't agree with this advice.  "cp -a" works perfectly well and
> I think that's a valuable thing.

Agreed. Note that "cp -a" really _duplicates_ a repo: refs, config, unreferenced objects, current packed state, etc. Using git to copy makes a clone, which is subtly different. So I don't think there is any reason to dissuade people from "cp -a" (cp without "-a", on the other hand, can be problematic as shown here).

-Peff
Junio C Hamano· Mar 14, 2011, 19:44 UTC · re: Jonathan Nieder · lore

Re: 'typechange' in the git-status output

Jonathan Nieder <jrnieder@gmail.com> writes:
Show 5 quoted lines
> On the other hand, if you want to _back up_ or sneakernet a git repo,
> I agree that "git bundle create /path/to/backup.bundle --all" is
> better.
>
> Perhaps the user manual could explain this somewhere.

I agree "bundle" documentation would be a good place to show that "better" way.

← back to recent threads