[infinispan-dev] Stashed changes could be dropped when running git sync script

Galder Zamarreño galder at redhat.com
Mon Nov 15 05:56:27 EST 2010


Hmmm, I was working on a topic branch for https://jira.jboss.org/browse/ISPN-770 and tried to run https://gist.github.com/667673 but now my local, uncommitted, changes were gone.

Judging from log (see attached), it appears that the stash was popped on 4.0.x branch but after checking out 4.0.x, the changes are not there either.

I've tried to list stashes that were dropped erroneously and I see:

[z at dhcp-144-240:~/Go/code/galder.infinispan.git]% git fsck --unreachable | grep commit | cut -d\  -f3 | xargs git log --merges --no-walk --grep=WIP
commit a45be8ad3c1acbb74e7d66eba1696880c6844bc2
Merge: 03c776a 7e7b664
Author: Galder Zamarreño <galder at jboss.org>
Date:   Mon Nov 15 10:47:20 2010 +0100

    WIP on ispn770_master: 03c776a ISPN-731 - make rehashing state and tx log draining serial addendum to dd3e7e6 commit

Once I had do that, I was able to apply that stash via: git stash apply a45be8ad3c1acbb74e7d66eba1696880c6844bc2

Looking at the script again, it appears that the changes were popped in the pop call within sync(). I think the reason this happened is cos 'git status --porcelain' is not empty for 4.0.x or 4.1.x due to having untracked files (ignores have not been updated there).

So, a way to solve this might be to update ignores in those branches as well. That way we avoid untracked files being mistakenly being detected. 

However, this might still break in the future. Another possibility I see would be for the script to safe the git stash ref and to actually pop/apply that stash? That way the pop in sync() would not pop the initial stash, but the stash at the top of sync(). I don't see an easy way to do this though.

Maybe we need a different way to detect whether stashing is needed or not. For example, if only untracked files appear, 'git status --porcelain' is not empty, but 'git stash' won't have anything save. What about using the following?:

git status --porcelain --untracked-files=no

This might work better cos untracked files are not taken into account and hence we'd solve git ignore updates that are not ported over to old branches. I've just run this change locally and it worked fine for me, with my changes being properly stashed and restored.

Manik, thoughts? I've forked your script and applied the change in https://gist.github.com/700256

-------------- next part --------------
A non-text attachment was scrubbed...
Name: stashed-disspeared.log
Type: application/octet-stream
Size: 2805 bytes
Desc: not available
Url : http://lists.jboss.org/pipermail/infinispan-dev/attachments/20101115/38a86a78/attachment.obj 
-------------- next part --------------


Cheers,
--
Galder Zamarreño
Sr. Software Engineer
Infinispan, JBoss Cache



More information about the infinispan-dev mailing list