On Thu, 2005-04-14 at 10:28 +0200, Martin Schlemmer wrote: > On Thu, 2005-04-14 at 08:55 +0200, Martin Schlemmer wrote: > > On Thu, 2005-04-14 at 00:19 +0200, Petr Baudis wrote: > > > Dear diary, on Wed, Apr 13, 2005 at 02:15:37PM CEST, I got a letter > > > where Martin Schlemmer <azarah@nosferatu.za.org> told me that... > > > > On Wed, 2005-04-13 at 11:26 +0200, Petr Baudis wrote: > > > >> > Dear diary, on Wed, Apr 13, 2005 at 10:41:12AM CEST, I got a letter > > > > > where Martin Schlemmer <azarah@nosferatu.za.org> told me that... > > > > > > On Wed, 2005-04-13 at 09:54 +0200, Petr Baudis wrote: > > > > > > PS: not having looked deeper yet, why does fsck-cache always find > > > > > > unreferenced blobs/commits (no matter what tree is tracked, they stay > > > > > > the same) ? And trying to remove them leads to more, which leads to an > > > > > > empty .git/opjects/ =) Also, leading to this, will adding an option to > > > > > > remove disconnected commits/blobs from local commits (that was > > > > > > disconnected with a pull) be a viable option to add? > > > > > > > > > > fsck-cache is concerned only by the objects database, so all the HEADs > > > > > are unreferenced commits too. This is a right thing, the HEAD tracking > > > > > should stay purely in the scripts - if we want to make fsck-cache > > > > > smarter about that, we should implement git fsck or something. > > > > > > > > > > Killing unreferenced blobs should be safe, I think. > > > > > > > > > > > First, about the 'git diff' thing I asked yesterday .. what I meant, was > > > > > > should it actually output this: > > > > > > > > > > > > ---- > > > > > > COPYING: fe2a4177a760fd110e78788734f167bd633be8de 33 > > > > > > Makefile: 929aa49a3dbe683ad52094099797bc636a7949a6 33 > > > > > > README: 46c6a9ea48ddd1dda45ca585f49975a6869ffe51 33 > > > > > > ... > > > > > > ---- > > > > > > > > > > > > Shouldn't it just show actual changes? > > > > > > > > > > This is an actual change. It's just that it's a change to metadata > > > > > (somewhat esotherically described by the "33"), not the file contents. > > > > > > > > > > BTW, git diff does actually something completely different from git diff > > > > > with any arguments. It diffs to the directory cache, not to any tree! It > > > > > just wraps show-diff, which has also a different output format (not > > > > > outputting "git diffs"). The worst thing is that it requires a different > > > > > -p option to apply. Someone should purge this wart, I think. > > > > > > > > > > > > > Check applied patch (also in the new output). > > > > > > Please send patches inline and properly signed off. > > > > > > > The new evo have a bad habit of screwing the tabs, but sure. > > > > > > > > Also on the same note .. should 'git ci' without listed files to be > > > > > > committed, really add a reference to all files as it currently do in the > > > > > > commit/blob/whatever info, instead of just the changed/added files (see > > > > > > the git-seperate-dir.patch you have not yet commented on for reference)? > > > > > > > > > > ... > > > > > > > > > > > > > Patch will also resolve this. > > > > > > Your patch is bad - it removes the pure metadata changes, but you > > > definitively do not want to do that! If you are annoyed by meaningless > > > time changes etc, do update-cache --refresh. Ignoring mode changes is a > > > pure disaster. > > > > > > > Ahh - and there was light. I do not have a problem with the mode > > changes - its just _all_ files was shown after tracked branch was > > changed. How about below patch? > > > > > > > > I know its in its infancy, but I am not sure on what scm you are basing > > > > > > it, so not sure how things should behave. > > > > > > > > > > I'm trying to base it on common sense and principle of least surprise. > > > > > :-) > > > > > > > > > > > > > Ok, I'll just bug you then if I am not sure on how you want something ;p > > > > > > Or do it somehow and I'll bug you back if I don't like it. ;-) > > > > > > > Ditto > > > > > > ---- > > > > Normalize show-diff output and make sure we only show real changes after > > changing the tracked branch. > > > > Signed-off-by: Martin Schlemmer <azarah@nosferatu.za.org> > > > > Ok, so I forgot to pull, and missed gitcancel.sh being added. > How about this one? (One attached in case evo is brain dead and mangles > the tabs) > Urk, forgot the update-cache in gitcancel.sh, and prefix is wrong. I am not sure this is needed for gitexport.sh though? ---- Normalize show-diff output, add --update-modes target to update-cache, and make sure we only show real changes after changing the tracked branch, as well as update the file modes according to the cache. Signed-off-by: Martin Schlemmer <azarah@nosferatu.za.org> gitcancel.sh: ec58f7444a42cd3cbaae919fc68c70a3866420c0 --- ec58f7444a42cd3cbaae919fc68c70a3866420c0/gitcancel.sh +++ uncommitted/gitcancel.sh @@ -12,7 +12,8 @@ # FIXME: Does not revert mode changes! -show-diff | patch -p0 -R +show-diff | patch -p1 -R rm -f .git/add-queue .git/rm-queue .git/merged -update-cache --refresh +# --update-modes need to be before --refresh +update-cache --update-modes --refresh gittrack.sh: 03d6db1fb3a70605ef249c632c04e542457f0808 --- 03d6db1fb3a70605ef249c632c04e542457f0808/gittrack.sh +++ uncommitted/gittrack.sh @@ -51,6 +51,8 @@ read-tree $(tree-id "$name") gitdiff.sh local "$name" | gitapply.sh + # --update-modes need to be before --refresh + update-cache --update-modes --refresh else [ "$tracking" ] || \ @@ -61,6 +63,8 @@ if [ -s ".git/HEAD.local" ]; then gitdiff.sh "$tracking" local | gitapply.sh read-tree $(tree-id local) + # --update-modes need to be before --refresh + update-cache --update-modes --refresh head=$(cat .git/HEAD) branchhead=$(cat .git/heads/$tracking) show-diff.c: a531ca4078525d1c8dcf84aae0bfa89fed6e5d96 --- a531ca4078525d1c8dcf84aae0bfa89fed6e5d96/show-diff.c +++ uncommitted/show-diff.c @@ -5,13 +5,18 @@ */ #include "cache.h" -static void show_differences(char *name, +static void show_differences(struct cache_entry *ce, void *old_contents, unsigned long long old_size) { static char cmd[1000]; + static char sha1[41]; + int n; FILE *f; - snprintf(cmd, sizeof(cmd), "diff -L %s -u -N - %s", name, name); + for (n = 0; n < 20; n++) + snprintf(&(sha1[n*2]), 3, "%02x", ce->sha1[n]); + snprintf(cmd, sizeof(cmd), "diff -L %s/%s -L uncommitted/%s -u -N - %s", + sha1, ce->name, ce->name, ce->name); f = popen(cmd, "w"); if (old_size) fwrite(old_contents, old_size, 1, f); @@ -99,7 +104,7 @@ continue; new = read_sha1_file(ce->sha1, type, &size); - show_differences(ce->name, new, size); + show_differences(ce, new, size); free(new); } return 0; update-cache.c: 62d0a6c41560d40863c44599355af10d9e089312 --- 62d0a6c41560d40863c44599355af10d9e089312/update-cache.c +++ uncommitted/update-cache.c @@ -210,6 +210,39 @@ } } +static struct cache_entry *update_file_mode(struct cache_entry *ce) +{ + struct stat st; + int changed; + + if (stat(ce->name, &st) < 0) + return NULL; + + changed = cache_match_stat(ce, &st); + if (!changed) + return ce; + + if (changed & MODE_CHANGED) + if (chmod(ce->name, ce->st_mode)) + return NULL; + + return ce; +} + +static void update_modes(void) +{ + int i; + + for (i = 0; i < active_nr; i++) { + struct cache_entry *ce = active_cache[i]; + + if (!update_file_mode(ce)) { + printf("%s: needs update\n", ce->name); + continue; + } + } +} + /* * We fundamentally don't like some paths: we don't want * dot or dot-dot anywhere, and in fact, we don't even want @@ -282,6 +315,10 @@ refresh_cache(); continue; } + if (!strcmp(path, "--update-modes")) { + update_modes(); + continue; + } die("unknown option %s", path); } if (!verify_path(path)) { -- Martin Schlemmer - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
This archive was generated by hypermail 2.1.8 : 2005-04-15 11:38:20 EST