Re: Can't git stash after using git add -N

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Mar 16, 2016 at 11:51 AM, Junio C Hamano <gitster@xxxxxxxxx> wrote:
> Josh Triplett <josh@xxxxxxxxxxxxxxxx> writes:
>
>> As far as I can tell, if I run "git add -N" on a file, and then commit
>> without adding the file contents, it gets committed as an empty file.
>
> Is that true?  Git once worked like that in earlier days, but I
> think write-tree (hence commit) would simply ignore intent-to-add
> entries from its resulting tree.

We have at least one problem, probably because of the confusion in
diff code (I haven't checked further), which may be fixed once i
re-fix d95d728 (diff-lib.c: adjust position of i-t-a entries in diff -
2015-03-16)

> /tmp $ git init a
Initialized empty Git repository in /tmp/a/.git/
> /tmp $ cd a
> /tmp/a $ git ci --allow-empty -m 1
[master (root-commit) 4d8aed4] 1
> /tmp/a $ git add -N new
fatal: pathspec 'new' did not match any files

So far so good..

> /tmp/a $ touch new
> /tmp/a $ git add -N new

OK let's delete "new" and trigger this problem

> /tmp/a $ rm new
> /tmp/a $ git ci -m NOOOO
[master ce2e4bb] NOOOO
> /tmp/a $ git cat-file commit HEAD|grep ^tree
tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904
> /tmp/a $ git cat-file commit HEAD^|grep ^tree
tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904

The second commit should not be created. git-commit is somehow fooled
that there's changes to commit.
-- 
Duy
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]