* Re: ~ and ^
From: Sean @ 2007-05-13 19:49 UTC (permalink / raw)
To: Karl Hasselström; +Cc: Junio C Hamano, git
In-Reply-To: <20070513191350.GB14657@diana.vm.bytemark.co.uk>
On Sun, 13 May 2007 21:13:50 +0200
Karl Hasselström <kha@treskal.com> wrote:
> It seems that ~foo is only expanded to foo's home if there is such a
> user. Since all-numeric users probably aren't common, we can probably
> get away with it.
Someone just mentioned to me that ~# is expanded by Bash if you use the
pushd command to keep a directory stack. So ~1 will stop working
if you use "pushd". Maybe it'd be more confusing than helpful. On the
other hand, there's probably no reason for Git to just give an error
message if it receives a properly escaped lone "~", "~#", or "^".
Sean
^ permalink raw reply
* Re: [PATCH (amend)] cvsserver: Add test cases for config file handling
From: Junio C Hamano @ 2007-05-13 20:04 UTC (permalink / raw)
To: Frank Lichtenheld; +Cc: git
In-Reply-To: <117901685018-git-send-email-frank@lichtenheld.de>
Frank Lichtenheld <frank@lichtenheld.de> writes:
> Add a few test cases for the config file parsing
> done by git-cvsserver.
>
> Signed-off-by: Frank Lichtenheld <frank@lichtenheld.de>
> ---
> t/t9420-git-cvsserver-config.sh | 109 +++++++++++++++++++++++++++++++++++++++
> 1 files changed, 109 insertions(+), 0 deletions(-)
> create mode 100755 t/t9420-git-cvsserver-config.sh
Do we really need a separate test script that does quite similar setup?
^ permalink raw reply
* [StGIT PATCH] Test the new DAG appliedness machinery
From: Karl Hasselström @ 2007-05-13 20:05 UTC (permalink / raw)
To: Catalin Marinas; +Cc: git
In-Reply-To: <20070513184558.19482.51776.stgit@yoghurt>
Signed-off-by: Karl Hasselström <kha@treskal.com>
---
And here's a test that demonstrates situations where it's useful.
t/t3000-git-interop.sh | 60 ++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 60 insertions(+), 0 deletions(-)
diff --git a/t/t3000-git-interop.sh b/t/t3000-git-interop.sh
new file mode 100755
index 0000000..44414b9
--- /dev/null
+++ b/t/t3000-git-interop.sh
@@ -0,0 +1,60 @@
+#!/bin/sh
+# Copyright (c) 2007 Karl Hasselström
+test_description='Test git/StGIT interoperability'
+. ./test-lib.sh
+
+test_expect_success \
+ 'Create some git-only history' '
+ echo foo > foo.txt &&
+ git add foo.txt &&
+ git commit -a -m foo &&
+ git tag foo-tag &&
+ for i in 0 1 2 3 4; do
+ echo foo$i >> foo.txt &&
+ git commit -a -m foo$i;
+ done
+'
+
+test_expect_success \
+ 'Initialize the StGIT repository' '
+ stg init
+'
+
+test_expect_success \
+ 'Create five patches' '
+ for i in 0 1 2 3 4; do
+ stg new p$i -m p$i;
+ done &&
+ [ "$(echo $(stg applied))" = "p0 p1 p2 p3 p4" ] &&
+ [ "$(echo $(stg unapplied))" = "" ]
+'
+
+test_expect_success \
+ 'Pop two patches with git-reset' '
+ git reset --hard HEAD~2 &&
+ [ "$(echo $(stg applied))" = "p0 p1 p2" ] &&
+ [ "$(echo $(stg unapplied))" = "p3 p4" ]
+'
+
+test_expect_success \
+ 'Create a new patch' '
+ stg new q0 -m q0 &&
+ [ "$(echo $(stg applied))" = "p0 p1 p2 q0" ] &&
+ [ "$(echo $(stg unapplied))" = "p3 p4" ]
+'
+
+test_expect_success \
+ 'Go to an unapplied patch with with git-reset' '
+ git reset --hard $(stg id p3) &&
+ [ "$(echo $(stg applied))" = "p0 p1 p2 p3" ] &&
+ [ "$(echo $(stg unapplied))" = "q0 p4" ]
+'
+
+test_expect_success \
+ 'Go back to below the stack base with git-reset' '
+ git reset --hard foo-tag &&
+ [ "$(echo $(stg applied))" = "" ] &&
+ [ "$(echo $(stg unapplied))" = "p0 p1 p2 q0 p3 p4" ]
+'
+
+test_done
^ permalink raw reply related
* Re: ~ and ^
From: Robin Rosenberg @ 2007-05-13 20:31 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Sean, git
In-Reply-To: <7v8xbssfti.fsf@assigned-by-dhcp.cox.net>
söndag 13 maj 2007 skrev Junio C Hamano:
> Sean <seanlkml@sympatico.ca> writes:
>
> > Would it be possible/reasonable to treat a bare ~3 (or ^) on the git command
> > line as equivalent to "<current branch>~3" ? At least @{3} already works
> > this way and it would be nice to do the same for the even more common tilde
> > and hat operations. If so, it would be a small convenience to just type:
> > "git show ~3"
>
> Interesting.
>
> At least, "ls ~0" does not seem to get confused by bash to be
> the home directory of the root user, so I do not offhand think
> of a reason not to have ~$n as a synonym to HEAD~$n. Would that
> be useful? I dunno.
~0 is my current directory in bash.
$ echo ~0
/home/me/tmp
-- robin
^ permalink raw reply
* Re: [RFC] Optimize diff-delta.c
From: Martin Koegler @ 2007-05-13 20:50 UTC (permalink / raw)
To: Nicolas Pitre; +Cc: git, Martin Koegler
---
On Fri, 04 May 2007, Nicolas Pitre wrote:
> On Fri, 4 May 2007, Martin Koegler wrote:
> > On 2007-05-01 16:05:24, Nicolas Pitre wrote:
> > In the long term, I think, that the delta generation code needs to get
> > tunable.
>
> No. It should be self-tunable certainly, but there are way too many
> config options already, and another one for the inner working of the
> delta algorithm would be a bit too esoteric for most users and they
> won't get advantage of it. This thing really has to self tune itself.
I would like that too, but that will probably not the case for
everybody.
Why does git has options to control the zlib compression?
Why are patches like "Custom compression levels for objects and packs"
(http://www.spinics.net/lists/git/msg30244.html) sent to the mailing
list?
> > > > I tried to speed up the delta generation by searching for a common
> > > > prefix, as my blobs are mostly append only. I tested it with about
> > > > less than 1000 big blobs. The time for finding the deltas decreased
> > > > from 17 to 14 minutes cpu time.
> > >
> > > I'm surprised that your patch makes so much of a difference. Normally
> > > the first window should always match in the case you're trying to
> > > optimize and the current code should already perform more or less the
> > > same as your common prefix match does.
> >
> > A block is limited to 64k. If the file has some hundred MBs, it has to
> > match many blocks.
>
> Only if the first match is smaller than 64K. If the first match is 64K
> in size then the rest of the file is not considered at all.
If I read the code correctly, the currect code does a new hash table
search after writing a block.
> > My patch can process everything except the few last thousand lines by
> > doing a memcmp.
> >
> > Additionally, nearly every line starts with the same, longer than 16
> > byte prefix. So its likely, that many blocks map to the same hash
> > value.
>
> The hash index only remembers the lowest of consecutive identical blocks
> so repeated blocks are indexed only with the first one. If however you
> happen to have many identical blocks interlaced between other blocks
> then there is not much that can be done. What the code does in that
> case is to trim those hash buckets that gets too large by keeping only a
> few entries across the reference buffer to avoid a O(n^2) behavior. But
> that happens only when your line beginnings are located on the same
> block boundary (but with a block size of 16 this is rather likely in the
> presence of lots of lines I suppose).
>
> I'll be very interested in the results you get with my suggested patch.
As my original patch is not considering other and possibly better
matches, I rewrote the patch. The new version matches block of
unlimited length (stopping after finding a match >=64kB). If the block
it bigger than 64kB, it writes block of 64kB in a loop.
The patch recomputes the hash of 16 bytes after writing a block, as I
haven't had time to correct the hash update code for blocks < 16
bytes. (By the way, is this code path necessary?)
I did some tests on differenent machines:
Repacking a test repository with big blobs:
- original version:
Total 6452 (delta 4582), reused 1522 (delta 0)
11752.26user 4256.21system 4:26:52elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (576major+1042499851minor)pagefaults 0swaps
=>92 MB pack size
- your patch (stop at 4096 bytes block size):
Total 6452 (delta 4582), reused 1522 (delta 0)
11587.41user 4064.73system 4:20:54elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (0major+1042500427minor)pagefaults 0swaps
=>92 MB pack size
- my first patch
Total 6452 (delta 4706), reused 1450 (delta 0)
10316.93user 4220.67system 4:02:20elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (0major+1045003394minor)pagefaults 0swaps
=>92 MB pack size
- attached patch
Total 6452 (delta 4581), reused 1522 (delta 0)
11354.38user 5451.60system 4:40:09elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (0major+1371504762minor)pagefaults 0swaps
=>75 MB pack size
Repacking git.git repository:
- original version
Total 42893 (delta 29900), reused 12400 (delta 0)
57.32user 1.17system 1:03.73elapsed 91%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (267major+47813minor)pagefaults 0swaps
11538746 bytes pack size
- attached patch
Total 42893 (delta 29899), reused 12400 (delta 0)
57.04user 0.80system 1:00.68elapsed 95%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (7major+28628minor)pagefaults 0swaps
11538869 bytes pack size
Repacking linux kernel repository:
- original version
Total 467313 (delta 376494), reused 78113 (delta 0)
809.08user 39.59system 36:54.70elapsed 38%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (83839major+1257686minor)pagefaults 0swaps
149460017 bytes pack size
- attached patch
Total 467313 (delta 376495), reused 78113 (delta 0)
806.27user 37.81system 35:06.12elapsed 40%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (79755major+1235874minor)pagefaults 0swaps
149336835 bytes pack size
The following patch is only for testing purposes and not cleaned up.
diff-delta.c | 105 +++++++++++++++++++++++++++++++++++++--------------------
1 files changed, 68 insertions(+), 37 deletions(-)
diff --git a/diff-delta.c b/diff-delta.c
index 9f998d0..df9b336 100644
--- a/diff-delta.c
+++ b/diff-delta.c
@@ -305,8 +305,6 @@ create_delta(const struct delta_index *index,
continue;
if (ref_size > top - src)
ref_size = top - src;
- if (ref_size > 0x10000)
- ref_size = 0x10000;
if (ref_size <= msize)
break;
while (ref_size-- && *src++ == *ref)
@@ -315,6 +313,8 @@ create_delta(const struct delta_index *index,
/* this is our best match so far */
msize = ref - entry->ptr;
moff = entry->ptr - ref_data;
+ if (msize >= 0x10000)
+ break;
}
}
@@ -328,30 +328,15 @@ create_delta(const struct delta_index *index,
inscnt = 0;
}
} else {
- unsigned char *op;
-
- if (msize >= RABIN_WINDOW) {
- const unsigned char *sk;
- sk = data + msize - RABIN_WINDOW;
- val = 0;
- for (i = 0; i < RABIN_WINDOW; i++)
- val = ((val << 8) | *sk++) ^ T[val >> RABIN_SHIFT];
- } else {
- const unsigned char *sk = data + 1;
- for (i = 1; i < msize; i++) {
- val ^= U[sk[-RABIN_WINDOW]];
- val = ((val << 8) | *sk++) ^ T[val >> RABIN_SHIFT];
- }
- }
-
+ unsigned int wsize, undo = 0;
+
if (inscnt) {
while (moff && ref_data[moff-1] == data[-1]) {
- if (msize == 0x10000)
- break;
/* we can match one byte back */
msize++;
moff--;
data--;
+ undo++;
outpos--;
if (--inscnt)
continue;
@@ -359,27 +344,72 @@ create_delta(const struct delta_index *index,
inscnt--; /* make it -1 */
break;
}
- out[outpos - inscnt - 1] = inscnt;
+ out[outpos - inscnt - 1] = inscnt;
inscnt = 0;
}
+
+ wsize=msize;
+ while (wsize >= 4)
+ {
+ unsigned char *op;
+ unsigned int boff, bsize;
+ boff = moff;
+ bsize = wsize;
+
+ if (bsize > 0x10000)
+ bsize = 0x10000;
+
+ moff += bsize;
+ wsize -= bsize;
+
+ op = out + outpos++;
+ i = 0x80;
+
+ if (boff & 0xff) { out[outpos++] = boff; i |= 0x01; }
+ boff >>= 8;
+ if (boff & 0xff) { out[outpos++] = boff; i |= 0x02; }
+ boff >>= 8;
+ if (boff & 0xff) { out[outpos++] = boff; i |= 0x04; }
+ boff >>= 8;
+ if (boff & 0xff) { out[outpos++] = boff; i |= 0x08; }
+
+ if (bsize & 0xff) { out[outpos++] = bsize; i |= 0x10; }
+ bsize >>= 8;
+ if (bsize & 0xff) { out[outpos++] = bsize; i |= 0x20; }
+
+ *op = i;
+
+ if (outpos >= outsize - MAX_OP_SIZE) {
+ void *tmp = out;
+ outsize = outsize * 3 / 2;
+ if (max_size && outsize >= max_size)
+ outsize = max_size + MAX_OP_SIZE + 1;
+ if (max_size && outpos > max_size)
+ goto out;
+ out = xrealloc(out, outsize);
+ if (!out) {
+ free(tmp);
+ return NULL;
+ }
+ }
+ }
+
+ msize -= wsize;
+ if (msize - undo >= RABIN_WINDOW || 1) {
+ const unsigned char *sk;
+ sk = data + msize - RABIN_WINDOW;
+ val = 0;
+ for (i = 0; i < RABIN_WINDOW; i++)
+ val = ((val << 8) | *sk++) ^ T[val >> RABIN_SHIFT];
+ } else {
+ const unsigned char *sk = data + 1;
+ for (i = 1; i < msize; i++) {
+ val ^= U[sk[-RABIN_WINDOW + undo]];
+ val = ((val << 8) | *sk++) ^ T[val >> RABIN_SHIFT];
+ }
+ }
data += msize;
- op = out + outpos++;
- i = 0x80;
-
- if (moff & 0xff) { out[outpos++] = moff; i |= 0x01; }
- moff >>= 8;
- if (moff & 0xff) { out[outpos++] = moff; i |= 0x02; }
- moff >>= 8;
- if (moff & 0xff) { out[outpos++] = moff; i |= 0x04; }
- moff >>= 8;
- if (moff & 0xff) { out[outpos++] = moff; i |= 0x08; }
-
- if (msize & 0xff) { out[outpos++] = msize; i |= 0x10; }
- msize >>= 8;
- if (msize & 0xff) { out[outpos++] = msize; i |= 0x20; }
-
- *op = i;
}
if (outpos >= outsize - MAX_OP_SIZE) {
@@ -397,6 +427,7 @@ create_delta(const struct delta_index *index,
}
}
+ out:
if (inscnt)
out[outpos - inscnt - 1] = inscnt;
--
1.4.4.4
^ permalink raw reply related
* Re: [BUG] git-svn dcommit fails (connection closed unexpectedly)
From: Eric Wong @ 2007-05-13 21:01 UTC (permalink / raw)
To: Karl Hasselström; +Cc: Martin Eisenhardt, git, Matthieu.Moy
In-Reply-To: <20070513182405.GA13618@diana.vm.bytemark.co.uk>
Karl Hasselström <kha@treskal.com> wrote:
> On 2007-05-13 19:49:34 +0200, Martin Eisenhardt wrote:
>
> > Another case where I stumbled upon said error message was when I
> > added an empty (sub)directory to a project in subversion and then
> > used git to track that project. Since git cannot track an empty
> > directory, it did not appear in my git working copy. When I mkdir'd
> > the directory locally (in my git wc) and then tried to add files
> > within that repository, I got exactly the same error as Matthieu.
Interesting. I don't think git-svn currently checks for that case.
> It might be a net win to let git-svn handle empty directories by
> creating an empty .git-svn-empty-dir file in them, instead of
> pretending they don't exist.
No. This is *WAY* too ugly.
--
Eric Wong
^ permalink raw reply
* RFH for [PATCH] Optimized cvsexportcommit: calling 'cvs status' only once instead of once per changed file.
From: Junio C Hamano @ 2007-05-13 21:01 UTC (permalink / raw)
To: git; +Cc: Steffen Prohaska, Robin Rosenberg, Martin Langhoff
In-Reply-To: <7vd519m9z7.fsf@assigned-by-dhcp.cox.net>
I'd like to have feedbacks on this patch, as I think what it
tries to do is sensible and worth to have it in v1.5.2 if it
works for people.
Ack? Nack? YesButNeedsmorework?
^ permalink raw reply
* Re: RFH for [PATCH] Optimized cvsexportcommit: calling 'cvs status' only once instead of once per changed file.
From: Robin Rosenberg @ 2007-05-13 21:51 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, Steffen Prohaska, Martin Langhoff
In-Reply-To: <7vps54qvya.fsf_-_@assigned-by-dhcp.cox.net>
söndag 13 maj 2007 skrev Junio C Hamano:
> I'd like to have feedbacks on this patch, as I think what it
> tries to do is sensible and worth to have it in v1.5.2 if it
> works for people.
>
> Ack? Nack? YesButNeedsmorework?
Looks good, but I haven't tried it for production work yet.
-- robin
^ permalink raw reply
* Re: Segmentation fault in git-svn
From: Steven Grimm @ 2007-05-13 22:04 UTC (permalink / raw)
To: Eric Wong; +Cc: git, Peter Baumann
In-Reply-To: <20070513082118.GC1168@muzzle>
I can confirm that the patch fixes the segfault for me too. Thanks!
-Steve
^ permalink raw reply
* [ANNOUNCE] cgit v0.4
From: Lars Hjemli @ 2007-05-13 22:24 UTC (permalink / raw)
To: git
I've just tagged and pushed v0.4 of cgit. Notable changes since 0.3
include graphical diffstat for commit, full commitdiff against each
parent, number of changed files/lines per commit in log view and
support for shortcuts to tarballs etc. on the repo summary page (using
refs/archives namespace).
The release is now running on http://hjemli.net/git/cgit/ and can be
cloned from git://hjemli.net/pub/git/cgit
---
Shortlog since v0.3:
Lars Hjemli (13):
Makefile: add support for building w.o. preinstalled git
Add links to enable downloading of tagged blobs
css: fix bad rendering in Internet Explorer
Add shared diff-handling functions
Use standard tree-diff function when showing diffstat for single commit
Show number of changed files in log view
Add standard interface for file diff functions
Simplify ui-diff.c using the new file-level diff interface
Show number of changed lines in log view
Add max-commit-count parameter to cgitrc
Add graphical diffstat to commit view
Add commitdiff between commit and each of it's parent
cgit v0.4
--
larsh
^ permalink raw reply
* What's cooking in git.git (topics)
From: Junio C Hamano @ 2007-05-13 22:29 UTC (permalink / raw)
To: git
Here are the topics that have been cooking. Commits prefixed
with '-' are only in 'pu' while commits prefixed with '+' are
in 'next'. The topics list the commits in reverse chronological
order.
* sp/cvsexport (Thu May 10 01:06:36 2007 +0200) 1 commit
- Optimized cvsexportcommit: calling 'cvs status' once instead of
once per touched file.
This is waiting for Ack/Nack to make sure there is no unexpected
side effects but I am hoping we can ship v1.5.2 with this.
* dh/pack (Wed May 9 13:56:50 2007 -0700) 3 commits
+ Custom compression levels for objects and packs
+ make "repack -f" imply "pack-objects --no-reuse-object"
+ allow for undeltified objects not to be reused
* tt/gc (Wed May 9 15:48:39 2007 -0400) 1 commit
+ Add --aggressive option to 'git gc'
* np/pack (Wed May 9 14:42:42 2007 -0400) 3 commits
+ deprecate the new loose object header format
+ make "repack -f" imply "pack-objects --no-reuse-object"
+ allow for undeltified objects not to be reused
* sv/checkout (Wed May 9 12:33:20 2007 +0200) 1 commit
+ git-update-ref: add --no-deref option for overwriting/detaching
ref
* jb/statcolor (Sat May 5 16:48:54 2007 -0400) 1 commit
+ Add colour support in rebase and merge tree diff stats output.
New features, all deemed to be safe. To merge early after v1.5.2.
* db/remote (Sat May 12 11:46:03 2007 -0400) 3 commits
- Add handlers for fetch-side configuration of remotes.
- Move refspec parser from connect.c and cache.h to remote.{c,h}
- Move remote parsing into a library file out of builtin-push.
Hopefully be in 'next' after v1.5.2; I haven't really played
with it. The next step would probably be to add some stuff that
use this series in fetch--tool, to further rewrite git-fetch
itself in C, or maybe wholesale rewrite of git-fetch in C.
* dh/repack (Tue May 8 13:05:04 2007 -0700) 5 commits
- git-repack --max-pack-size: add option parsing to enable feature
- git-repack --max-pack-size: split packs as asked by
write_{object,one}()
- git-repack --max-pack-size: write_{object,one}() respect pack
limit
- git-repack --max-pack-size: new file statics and code
restructuring
- Alter sha1close() 3rd argument to request flush only
Hopefully will have a series rebased on top of 'master' after
the first batch after v1.5.2 graduates.
* jc/blame (Fri Apr 20 16:25:50 2007 -0700) 4 commits
- blame: show log as it goes
- git-blame: optimize get_origin() from linear search to hash-
lookup.
- git-blame: pass "struct scoreboard *" pointers around.
- blame: lift structure definitions up
* jc/diff (Mon Dec 25 01:08:50 2006 -0800) 2 commits
- test-para: combined diff between HEAD, index and working tree.
- para-walk: walk n trees, index and working tree in parallel
Stalled.
^ permalink raw reply
* What's in git.git (stable)
From: Junio C Hamano @ 2007-05-13 22:30 UTC (permalink / raw)
To: git
We accumulated quite a few fixes on 'maint' since v1.5.1.4, and
they apply to 'master' as well.
Things that are not in 'master' yet but are scheduled for v1.5.2
final are a performance bug fix for cvsexportcommit (in 'pu')
and user manual updates to add a bit of source code tour, which
hopefully would happen by the middle of the week, and then we
will have the final v1.5.2 next weekend.
----------------------------------------------------------------
* The 'maint' branch has these fixes since v1.5.1.4
Alex Riesen (1):
Allow fetching references from any namespace
Eric Wong (4):
git-svn: don't drop the username from URLs when dcommit is run
git-svn: clean up caching of SVN::Ra functions
git-svn: fix segfaults due to initial SVN pool being cleared
git-svn: don't attempt to minimize URLs by default
Jan Hudec (1):
Updated documentation of hooks in git-receive-pack.
Jari Aalto (1):
SPECIFYING RANGES typo fix: it it => it is
Junio C Hamano (4):
git-clone: don't get fooled by $PWD
.mailmap: add some aliases
checkout: allow detaching to HEAD even when switching to the tip of a branch
git-config: do not forget seeing "a.b.var" means we are out of "a.var" section.
Marco Costalba (1):
Fix an unmatched comment end in arm/sha1_arm.S
Matthieu Castet (1):
Remove stale non-static-inline prototype for tree_entry_extract()
Quy Tonthat (1):
RPM spec: include files in technical/ to package.
Richard P. Curnow (2):
Fix documentation of tag in git-fast-import.txt
Fix documentation of tag in git-fast-import.txt
Shawn O. Pearce (1):
Properly handle '0' filenames in import-tars
Steffen Prohaska (2):
tiny fix in documentation of git-clone
git-config: test for 'do not forget "a.b.var" ends "a.var" section'.
* The 'master' branch has these since v1.5.2-rc3, in addition to the above.
Frank Lichtenheld (1):
cvsserver: Limit config parser to needed options
Jakub Narebski (2):
gitweb: Test if $from_id and $to_id are defined before comparison
gitweb: Check if requested object exists
Jan Hudec (1):
Minor fixup to documentation of hooks in git-receive-pack.
Jeff King (1):
git-add: allow path limiting with -u
Junio C Hamano (5):
Minor copyediting on Release Notes for 1.5.2
Add has_symlink_leading_path() function.
apply: do not get confused by symlinks in the middle
read-tree -m -u: avoid getting confused by intermediate symlinks.
Link to HTML version of external doc if available
Junio Hamano (1):
t9400: Use the repository config and nothing else.
Lars Hjemli (1):
git-archive: don't die when repository uses subprojects
^ permalink raw reply
* Re: What's cooking in git.git (topics)
From: Julian Phillips @ 2007-05-13 22:58 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <7v646wqrvm.fsf@assigned-by-dhcp.cox.net>
On Sun, 13 May 2007, Junio C Hamano wrote:
> * db/remote (Sat May 12 11:46:03 2007 -0400) 3 commits
> - Add handlers for fetch-side configuration of remotes.
> - Move refspec parser from connect.c and cache.h to remote.{c,h}
> - Move remote parsing into a library file out of builtin-push.
>
> Hopefully be in 'next' after v1.5.2; I haven't really played
> with it. The next step would probably be to add some stuff that
> use this series in fetch--tool, to further rewrite git-fetch
> itself in C, or maybe wholesale rewrite of git-fetch in C.
FWIW, I've got a largely functional C version of git-fetch ... the main
functionality is there - but it's not complete yet. In
addition to some of the non-core functionality being missing
(e.g. --tags or --no-tags in tagopt), I haven't been keeping
up with recent updates to fetch/fetch-tool. I was hoping to
have it ready for post-1.5.2 - unfortunately I've been rather busy the
last couple of weeks, and haven't managed to get as far as I'd hoped.
--
Julian
---
byob, v:
Believing Your Own Bull
^ permalink raw reply
* Re: [PATCH] git-add: allow path limiting with -u
From: Jakub Narebski @ 2007-05-13 10:35 UTC (permalink / raw)
To: Jeff King; +Cc: Junio C Hamano, git, cworth
In-Reply-To: <20070512064159.GA7471@coredump.intra.peff.net>
On Sat, 12 May 2007, Jeff King wrote:
> Rather than updating all working tree paths, we limit
> ourselves to paths listed on the command line.
>
> Signed-off-by: Jeff King <peff@peff.net>
> ---
> This turned out to be quite easy to implement. Patch is slightly larger
> than necessary due to removing _all_ from the variable names, but I
> think that better expresses the new functionality.
>
> I'm not sure that the documentation needs updated at all; I had just
> assumed after reading it that 'git-add -u foo' would DWIM.
Do git-add *needs* path specifier (even if it is '.') also for `-u'?
The changes in documentation were to reflect that `-u' is incompatibile
with explicit paths, or that `-u' does not require explicit paths
contrary to git-add without `-u'.
The fact that "add --interactive does not take any parameters" is
separate issue (which, accidentally, was adressed in the same patch).
--
Jakub Narebski
Poland
^ permalink raw reply
* [PATCH] gitweb: Fix "Use of unitialized value" warnings in empty repository
From: Jakub Narebski @ 2007-05-13 10:39 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <200705122116.34486.jnareb@gmail.com>
Fix it so gitweb doesn't write "Use of unitialized value..." warnings
(which gets written in web server logs) for empty (no commits)
repository.
In empty repository "last change" (last activity) doesn't make sense;
also there is no sense in parsing commits which aren't there.
In projects list for empty repositories gitweb now writes "No commits"
using "noage" class, instead of leaving cell empty, in the last change
column.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
Jakub Narebski wrote:
> One thing that is left is to fix "Use of initialized value..." warnings
> for empty repositories (initialized, but without any commits). But I
> don't think that this corner case is terribly important.
This patch fixes this issue.
gitweb/gitweb.perl | 30 +++++++++++++++++++-----------
1 files changed, 19 insertions(+), 11 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index d467bf3..c2eeca9 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -728,7 +728,9 @@ sub chop_str {
sub age_class {
my $age = shift;
- if ($age < 60*60*2) {
+ if (!defined $age) {
+ return "noage";
+ } elsif ($age < 60*60*2) {
return "age0";
} elsif ($age < 60*60*24*2) {
return "age1";
@@ -1258,7 +1260,8 @@ sub git_get_last_activity {
'refs/heads') or return;
my $most_recent = <$fd>;
close $fd or return;
- if ($most_recent =~ / (\d+) [-+][01]\d\d\d$/) {
+ if (defined $most_recent &&
+ $most_recent =~ / (\d+) [-+][01]\d\d\d$/) {
my $timestamp = $1;
my $age = time - $timestamp;
return ($age, age_string($age));
@@ -2983,7 +2986,7 @@ sub git_project_list_body {
esc_html($pr->{'descr'})) . "</td>\n" .
"<td><i>" . chop_str($pr->{'owner'}, 15) . "</i></td>\n";
print "<td class=\"". age_class($pr->{'age'}) . "\">" .
- $pr->{'age_string'} . "</td>\n" .
+ (defined $pr->{'age_string'} ? $pr->{'age_string'} : "No commits") . "</td>\n" .
"<td class=\"link\">" .
$cgi->a({-href => href(project=>$pr->{'path'}, action=>"summary")}, "summary") . " | " .
$cgi->a({-href => href(project=>$pr->{'path'}, action=>"shortlog")}, "shortlog") . " | " .
@@ -3335,7 +3338,7 @@ sub git_project_index {
sub git_summary {
my $descr = git_get_project_description($project) || "none";
my %co = parse_commit("HEAD");
- my %cd = parse_date($co{'committer_epoch'}, $co{'committer_tz'});
+ my %cd = %co ? parse_date($co{'committer_epoch'}, $co{'committer_tz'}) : ();
my $head = $co{'id'};
my $owner = git_get_project_owner($project);
@@ -3358,8 +3361,11 @@ sub git_summary {
print "<div class=\"title\"> </div>\n";
print "<table cellspacing=\"0\">\n" .
"<tr><td>description</td><td>" . esc_html($descr) . "</td></tr>\n" .
- "<tr><td>owner</td><td>$owner</td></tr>\n" .
- "<tr><td>last change</td><td>$cd{'rfc2822'}</td></tr>\n";
+ "<tr><td>owner</td><td>$owner</td></tr>\n";
+ if (defined $cd{'rfc2822'}) {
+ print "<tr><td>last change</td><td>$cd{'rfc2822'}</td></tr>\n";
+ }
+
# use per project git URL list in $projectroot/$project/cloneurl
# or make project git URL from git base URL and project name
my $url_tag = "URL";
@@ -3382,11 +3388,13 @@ sub git_summary {
# we need to request one more than 16 (0..15) to check if
# those 16 are all
- my @commitlist = parse_commits($head, 17);
- git_print_header_div('shortlog');
- git_shortlog_body(\@commitlist, 0, 15, $refs,
- $#commitlist <= 15 ? undef :
- $cgi->a({-href => href(action=>"shortlog")}, "..."));
+ my @commitlist = $head ? parse_commits($head, 17) : ();
+ if (@commitlist) {
+ git_print_header_div('shortlog');
+ git_shortlog_body(\@commitlist, 0, 15, $refs,
+ $#commitlist <= 15 ? undef :
+ $cgi->a({-href => href(action=>"shortlog")}, "..."));
+ }
if (@taglist) {
git_print_header_div('tags');
--
1.5.1.4
^ permalink raw reply related
* Re: suggestions for gitweb
From: Jakub Narebski @ 2007-05-13 11:50 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, Michael Niedermayer, Petr Baudis
In-Reply-To: <7vabw9v906.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano wrote:
> Jakub Narebski <jnareb@gmail.com> writes:
>
>> Lines of code and file sizes: file size needs additional invocation
>> per each file for gitweb; it would be easier for cgit. Costly!
>> Counting LOC is even more costly: take note that 1.) gitweb operates
>> directly on repository / object database, and does not use working
>> area, 2.) git is snapshot based and not changeset based.
>
> We earlier discussed to make --numstat to allow us add this kind
> of information for easier script consumption.
>
> Perhaps instead of modifying --numstat, we may be better off to
> add another format that can be more easily extended to support
> other things, like we do for the --porcelain format out of
> git-blame? It does not have to be one line per record, like the
> way --numstat was done, which was primarily in order to make it
> a compact, human readable format.
Even if we extend --numstat or add yet another diff format meant for
porcelain[*1*], and optionally add similar extension to git-ls-tree
(as I think object size and LOC of file should be placed there), and
the cost of additional fork and exec is not an issue, such extra
information be still costly in terms of performance: CPU and I/O.
Currently for difftree (whatchanged-like) we need only to compare
trees. For lines added / lines removed statistics we need to _generate_
diff.
For file size (object size) we need at least find the object in question
and read it's header; for lines of code we need to get blob contents
(find object, uncompress, optionally undeltify) and count the lines.
Its not insurmountable: we can use %feature for that, like in the case
of other CPU-intensive features like 'blame' or 'pickaxe', or
high-bandwidth features like 'snapshot'.
Footnotes:
----------
[*1*] What we should name it? --numstat-extended, --machinestat,
--porcelain, --allstat, <insert your own idea here>?
--
Jakub Narebski
Poland
^ permalink raw reply
* Re: suggestions for gitweb
From: Jakub Narebski @ 2007-05-13 11:18 UTC (permalink / raw)
To: Michael Niedermayer; +Cc: Junio C Hamano, git, Petr Baudis
In-Reply-To: <20070513000151.GT14859@MichaelsNB>
On Sun, 13 May 2007, Michael Niedermayer wrote:
> On Sat, May 12, 2007 at 03:39:25PM -0700, Junio C Hamano wrote:
>> Michael Niedermayer <michaelni@gmx.at> writes:
>>
>>> * gitweb uses many terms which are new to a non git user,
>>> [...] so i belive
>>> a small help text linked to from all pages which contains a short
>>> definition of all the git(web) specific terms would be very helpfull
>>> something like
>>> blob - file at a specific revision/date
>>> tree - directory at a specific revision/date
>>> (short) log - project wide commit log
>>> history - short log equivalent for a file or directory
>>
>> Coming fron non-CVS camp, I think changing this to non-git terms
>> is very harmful than educating users who are migrating from
>> other systems.
>
> You must have misunderstand me :(
> I want to educate them, but I cannot as I am not speaking about ffmpeg
> developers/contributors but rather random people who are curious and
> want to take a look at the ffmpeg source
>
> For them a simple help link similar to "ViewVC Help" which ViewVC has
> on the bottom right of its pages would be great IMHO
> also the text above is a pure random suggestion by a svn user and was
> not intended to redefine any git terms
Back in the times where there was no git homepage, the git logo at
top right corner of gitweb page was link to git documentation
http://www.kernel.org/pub/software/scm/git/docs/
(with the title of "git documentation"), or to be more exact to HTML
version of git(7) man page. This page has link to git glossary, where
you can find explanation of this terms. Now it is link to git homepage;
I'm not sure where / if there is here link to git glossary.
It is very easy to change URL where git logo points to; either via
setting appropriate variables when running make to get gitweb.cgi out
of gitweb.perl, or via configuration file for gitweb. You can point
git logo to lead to your documentation of gitweb terms.
But gitweb was primarly meant for developers which works which git,
and have knowledge of git terms (and gitweb terms, as gitweb uses them).
Adding some gitweb-help.html page, linked somewhere from within gitweb
pages (I think it shouldn't be embedded in gitweb, like help for search
options is), certainly is possible. And perhaps we should do that, now
that gitweb is more widely deployed, and used by "accidental" users
(developers) with no knowledge of git, and perhaps even without
knowledge of SCM [terms].
By the way, I think only "blob" and perhaps "tree" terms really needs
explanation...
Sidenote: we used to have some links to 'blob_plain' action, which
returns exact contents of file at given revision to the browser
(trying to set appropriate mime type), named "plain" and some named
"raw". This ambiguity was resolved in favor of "raw". Is it better?
I'm not sure...
> [...]
>>> * on the history page there are "blob", "commitdiff" and "diff to current"
>>> the obvious missing one is "diff to previous" which would be the diff to
>>> the previous blob of this file
>>
>> Isn't that commitdiff, or commitdiff on that page does not limit
>> the diff to the blob?
>
> commitdiff doesn't limit it to the blob ...
It should be fairly easy to add "diff to prev" link, but is it really
needed? It would be yet another link. Diff to previous version of blob
is contained in "commitdiff" and is easy to find and go to... well,
unless you are used to make large commits...
--
Jakub Narebski
Poland
^ permalink raw reply
* [PATCH] Documentation: Split description of pretty formats of commit log
From: Jakub Narebski @ 2007-05-13 23:25 UTC (permalink / raw)
To: git
Split description of pretty formats into list of pretty options
(--pretty and --encoding) in new file Documentation/pretty-options.txt
and description of formats itself as a separate "PRETTY FORMATS"
section in pretty-formats.txt
While at it correct formatting a bit, to be better laid out in the
resulting manpages: git-rev-list(1), git-show(1), git-log(1) and
git-diff-tree(1). Those manpages now include pretty options in the
same place as it was before, and description of formats just after
all options.
Inspired by the split into two filesdocumentation for merge strategies:
Documentation/merge-options.txt and Documentation/merge-strategies.txt
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
I was fed up with the fact that description of pretty formats takes
so much place for some manpages directly in the middle of other options,
making manpage unnecessary hard to read. So here there are the patch
for this.
Note: I have tested only manpage output; HTML output style might be
a bit broken, but I think it was broken before.
Most of the patch Documentation/pretty-formats.txt is just
reformatting.
Documentation/git-diff-tree.txt | 5 ++-
Documentation/git-log.txt | 5 ++-
Documentation/git-rev-list.txt | 6 +++-
Documentation/git-show.txt | 3 ++
Documentation/pretty-formats.txt | 70 +++++++++++++++++--------------------
Documentation/pretty-options.txt | 14 +++++++
6 files changed, 62 insertions(+), 41 deletions(-)
create mode 100644 Documentation/pretty-options.txt
diff --git a/Documentation/git-diff-tree.txt b/Documentation/git-diff-tree.txt
index 5d6e9dc..6e660e2 100644
--- a/Documentation/git-diff-tree.txt
+++ b/Documentation/git-diff-tree.txt
@@ -73,7 +73,7 @@ separated with a single space are given.
This flag causes "git-diff-tree --stdin" to also show
the commit message before the differences.
-include::pretty-formats.txt[]
+include::pretty-options.txt[]
--no-commit-id::
git-diff-tree outputs a line with the commit ID when
@@ -104,6 +104,9 @@ include::pretty-formats.txt[]
if the diff itself is empty.
+include::pretty-formats.txt[]
+
+
Limiting Output
---------------
If you're only interested in differences in a subset of files, for
diff --git a/Documentation/git-log.txt b/Documentation/git-log.txt
index dd06527..0f353f6 100644
--- a/Documentation/git-log.txt
+++ b/Documentation/git-log.txt
@@ -25,7 +25,7 @@ This manual page describes only the most frequently used options.
OPTIONS
-------
-include::pretty-formats.txt[]
+include::pretty-options.txt[]
-<n>::
Limits the number of commits to show.
@@ -58,6 +58,9 @@ include::pretty-formats.txt[]
Show only commits that affect the specified paths.
+include::pretty-formats.txt[]
+
+
Examples
--------
git log --no-merges::
diff --git a/Documentation/git-rev-list.txt b/Documentation/git-rev-list.txt
index 1b12b4f..ab90a22 100644
--- a/Documentation/git-rev-list.txt
+++ b/Documentation/git-rev-list.txt
@@ -87,7 +87,7 @@ Using these options, gitlink:git-rev-list[1] will act similar to the
more specialized family of commit log tools: gitlink:git-log[1],
gitlink:git-show[1], and gitlink:git-whatchanged[1]
-include::pretty-formats.txt[]
+include::pretty-options.txt[]
--relative-date::
@@ -367,6 +367,10 @@ These options are mostly targeted for packing of git repositories.
Only useful with '--objects'; print the object IDs that are not
in packs.
+
+include::pretty-formats.txt[]
+
+
Author
------
Written by Linus Torvalds <torvalds@osdl.org>
diff --git a/Documentation/git-show.txt b/Documentation/git-show.txt
index 5a219ab..34c5caf 100644
--- a/Documentation/git-show.txt
+++ b/Documentation/git-show.txt
@@ -38,6 +38,9 @@ OPTIONS
For a more complete list of ways to spell object names, see
"SPECIFYING REVISIONS" section in gitlink:git-rev-parse[1].
+include::pretty-options.txt[]
+
+
include::pretty-formats.txt[]
diff --git a/Documentation/pretty-formats.txt b/Documentation/pretty-formats.txt
index d7ffc21..99fbd6b 100644
--- a/Documentation/pretty-formats.txt
+++ b/Documentation/pretty-formats.txt
@@ -1,31 +1,32 @@
---pretty[='<format>']::
-
- Pretty-prints the details of a commit. `--pretty`
- without an explicit `=<format>` defaults to 'medium'.
- If the commit is a merge, and if the pretty-format
- is not 'oneline', 'email' or 'raw', an additional line is
- inserted before the 'Author:' line. This line begins with
- "Merge: " and the sha1s of ancestral commits are printed,
- separated by spaces. Note that the listed commits may not
- necessarily be the list of the *direct* parent commits if you
- have limited your view of history: for example, if you are
- only interested in changes related to a certain directory or
- file. Here are some additional details for each format:
-
- * 'oneline'
+PRETTY FORMATS
+--------------
+
+If the commit is a merge, and if the pretty-format
+is not 'oneline', 'email' or 'raw', an additional line is
+inserted before the 'Author:' line. This line begins with
+"Merge: " and the sha1s of ancestral commits are printed,
+separated by spaces. Note that the listed commits may not
+necessarily be the list of the *direct* parent commits if you
+have limited your view of history: for example, if you are
+only interested in changes related to a certain directory or
+file.
+
+Here are some additional details for each format:
+
+* 'oneline'
<sha1> <title line>
-+
-This is designed to be as compact as possible.
- * 'short'
+ This is designed to be as compact as possible.
+
+* 'short'
commit <sha1>
Author: <author>
<title line>
- * 'medium'
+* 'medium'
commit <sha1>
Author: <author>
@@ -35,7 +36,7 @@ This is designed to be as compact as possible.
<full commit message>
- * 'full'
+* 'full'
commit <sha1>
Author: <author>
@@ -45,7 +46,7 @@ This is designed to be as compact as possible.
<full commit message>
- * 'fuller'
+* 'fuller'
commit <sha1>
Author: <author>
@@ -57,18 +58,16 @@ This is designed to be as compact as possible.
<full commit message>
-
- * 'email'
+* 'email'
From <sha1> <date>
From: <author>
Date: <date & time>
Subject: [PATCH] <title line>
- full commit message>
-
+ <full commit message>
- * 'raw'
+* 'raw'
+
The 'raw' format shows the entire commit exactly as
stored in the commit object. Notably, the SHA1s are
@@ -77,19 +76,22 @@ displayed in full, regardless of whether --abbrev or
true parent commits, without taking grafts nor history
simplification into account.
- * 'format:'
+* 'format:'
+
The 'format:' format allows you to specify which information
you want to show. It works a little bit like printf format,
with the notable exception that you get a newline with '%n'
instead of '\n'.
-
-E.g, 'format:"The author of %h was %an, %ar%nThe title was >>%s<<"'
++
+E.g, 'format:"The author of %h was %an, %ar%nThe title was >>%s<<%n"'
would show something like this:
-
++
+-------
The author of fe6e0ee was Junio C Hamano, 23 hours ago
The title was >>t4119: test autocomputing -p<n> for traditional diff input.<<
+--------
++
The placeholders are:
- '%H': commit hash
@@ -120,11 +122,3 @@ The placeholders are:
- '%m': left, right or boundary mark
- '%n': newline
-
---encoding[=<encoding>]::
- The commit objects record the encoding used for the log message
- in their encoding header; this option can be used to tell the
- command to re-code the commit log message in the encoding
- preferred by the user. For non plumbing commands this
- defaults to UTF-8.
-
diff --git a/Documentation/pretty-options.txt b/Documentation/pretty-options.txt
new file mode 100644
index 0000000..7d515be
--- /dev/null
+++ b/Documentation/pretty-options.txt
@@ -0,0 +1,14 @@
+--pretty[='<format>']::
+
+ Pretty print the contents of the commit logs in a given format,
+ where '<format>' can be one of 'oneline', 'short', 'medium',
+ 'full', 'fuller', 'email', 'raw' and 'format:<string>'.
+ When left out the format default to 'medium'.
+
+--encoding[=<encoding>]::
+ The commit objects record the encoding used for the log message
+ in their encoding header; this option can be used to tell the
+ command to re-code the commit log message in the encoding
+ preferred by the user. For non plumbing commands this
+ defaults to UTF-8.
+
--
1.5.1.4
^ permalink raw reply related
* Re: What's cooking in git.git (topics)
From: Junio C Hamano @ 2007-05-13 23:33 UTC (permalink / raw)
To: Julian Phillips; +Cc: git
In-Reply-To: <Pine.LNX.4.64.0705132348290.4791@beast.quantumfyre.co.uk>
Julian Phillips <julian@quantumfyre.co.uk> writes:
> On Sun, 13 May 2007, Junio C Hamano wrote:
>
>> * db/remote (Sat May 12 11:46:03 2007 -0400) 3 commits
>> - Add handlers for fetch-side configuration of remotes.
>> - Move refspec parser from connect.c and cache.h to remote.{c,h}
>> - Move remote parsing into a library file out of builtin-push.
>>
>> Hopefully be in 'next' after v1.5.2; I haven't really played
>> with it. The next step would probably be to add some stuff that
>> use this series in fetch--tool, to further rewrite git-fetch
>> itself in C, or maybe wholesale rewrite of git-fetch in C.
>
> FWIW, I've got a largely functional C version of git-fetch ... the
> main functionality is there - but it's not complete yet. In addition
> to some of the non-core functionality being missing (e.g. --tags or
> --no-tags in tagopt), I haven't been keeping up with recent updates to
> fetch/fetch-tool. I was hoping to have it ready for post-1.5.2 -
> unfortunately I've been rather busy the last couple of weeks, and
> haven't managed to get as far as I'd hoped.
Thanks for the status updates. Although I do not recall Daniel
saying it explicitly, I have been assuming that his series was
aiming for the same all along. It might be a good idea for you
two to compare notes sometime between now and v1.5.2?
^ permalink raw reply
* Re: RFD Use git for off-site backups
From: Shawn O. Pearce @ 2007-05-13 23:42 UTC (permalink / raw)
To: Jan Hudec; +Cc: Thomas Glanzmann, GIT
In-Reply-To: <20070513123436.GE8983@efreet.light.src>
Jan Hudec <bulb@ucw.cz> wrote:
> - Use Subversion. There is summer of code project to create git-svnserver,
> so you might be able to use git on the server-side in future with
> subversion client too. But for backups you should not need any of the
> version control features subversion does not have, so subversion should be
> suitable.
Unfortunately Google is not sponsering the git-svnserver summer of
code project. We didn't get enough slots for us to get Google to
pay for that one. At least one of the students has still expressed
interest in working on it, but it won't be their full-time job this
summer. :-(
--
Shawn.
^ permalink raw reply
* [PATCH] Show tags in history view
From: Robin Rosenberg @ 2007-05-13 23:39 UTC (permalink / raw)
To: spearce; +Cc: git, Robin Rosenberg
In-Reply-To: <11790995571637-git-send-email-robin.rosenberg@dewire.com>
Put some content into the Tags field in the history browser. Besides
tags we put matching branch names there too.
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
---
.../src/org/spearce/egit/ui/GitHistoryPage.java | 85 ++++++++++++++++++-
.../src/org/spearce/jgit/lib/Repository.java | 2 +-
2 files changed, 81 insertions(+), 6 deletions(-)
diff --git a/org.spearce.egit.ui/src/org/spearce/egit/ui/GitHistoryPage.java b/org.spearce.egit.ui/src/org/spearce/egit/ui/GitHistoryPage.java
index e5d92fe..8850405 100644
--- a/org.spearce.egit.ui/src/org/spearce/egit/ui/GitHistoryPage.java
+++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/GitHistoryPage.java
@@ -18,6 +18,7 @@ package org.spearce.egit.ui;
import java.io.IOException;
import java.util.Date;
+import java.util.HashMap;
import java.util.Map;
import org.eclipse.compare.CompareConfiguration;
@@ -78,6 +79,7 @@ import org.spearce.egit.core.project.RepositoryMapping;
import org.spearce.egit.ui.internal.actions.GitCompareRevisionAction;
import org.spearce.jgit.lib.Commit;
import org.spearce.jgit.lib.ObjectId;
+import org.spearce.jgit.lib.Tag;
import org.spearce.jgit.lib.Repository.StGitPatch;
public class GitHistoryPage extends HistoryPage implements IAdaptable,
@@ -145,7 +147,7 @@ public class GitHistoryPage extends HistoryPage implements IAdaptable,
if (item != null && item!=lastItem) {
IFileRevision rev = (IFileRevision) item.getData();
String commitStr=null;
- if (appliedPatches!=null) {
+ if (rev!=null && appliedPatches!=null) {
String id = rev.getContentIdentifier();
if (!id.equals("Workspace")) {
StGitPatch patch = (StGitPatch) appliedPatches.get(new ObjectId(id));
@@ -275,8 +277,34 @@ public class GitHistoryPage extends HistoryPage implements IAdaptable,
return id + "@.." + rs;
}
- if (columnIndex == 2)
- return ""; // TAGS
+ if (columnIndex == 2) {
+ String id = ((IFileRevision)element).getContentIdentifier();
+ ObjectId oid = new ObjectId(id);
+ StringBuilder b=new StringBuilder();
+ if (tags != null) {
+ Tag[] matching = tags.get(oid);
+ if (matching != null) {
+ for (Tag t : matching) {
+ if (b.length() > 0)
+ b.append(' ');
+ b.append(t.getTag());
+ }
+ }
+ }
+ if (branches != null) {
+ if (b.length() >0)
+ b.append('\n');
+ String[] matching = branches.get(oid);
+ if (matching != null) {
+ for (String t : matching) {
+ if (b.length() > 0)
+ b.append(' ');
+ b.append(t);
+ }
+ }
+ }
+ return b.toString();
+ }
if (columnIndex == 3) {
Date d = new Date(((IFileRevision) element).getTimestamp());
@@ -352,6 +380,8 @@ public class GitHistoryPage extends HistoryPage implements IAdaptable,
}
private Map appliedPatches;
+ private Map<ObjectId,Tag[]> tags;
+ private Map<ObjectId, String[]> branches;
class HistoryRefreshJob extends Job {
@@ -373,6 +403,48 @@ public class GitHistoryPage extends HistoryPage implements IAdaptable,
// TODO Auto-generated catch block
e.printStackTrace();
}
+ Map<ObjectId,Tag[]> newtags = new HashMap<ObjectId,Tag[]>();
+ try {
+ for (String name : repositoryMapping.getRepository().getTags()) {
+ Tag t = repositoryMapping.getRepository().mapTag(name);
+ Tag[] samecommit = newtags.get(t.getObjId());
+ if (samecommit==null) {
+ samecommit = new Tag[] { t };
+ } else {
+ Tag[] n=new Tag[samecommit.length+1];
+ for (int j=0; j<samecommit.length; ++j)
+ n[j] = samecommit[j];
+ n[n.length-1] = t;
+ samecommit = n;
+ }
+ newtags.put(t.getObjId(), samecommit);
+ }
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ Map<ObjectId, String[]> newBranches = new HashMap<ObjectId, String[]>();
+ try {
+ for (String branch : repositoryMapping.getRepository().getBranches()) {
+ ObjectId id = repositoryMapping.getRepository().resolve("refs/heads/"+branch);
+ String[] samecommit = newBranches.get(id);
+ if (samecommit == null) {
+ samecommit = new String[] { branch };
+ } else {
+ String[] n=new String[samecommit.length + 1];
+ for (int j=0; j<samecommit.length; ++j)
+ n[j] = samecommit[j];
+ n[n.length-1] = branch;
+ samecommit = n;
+ }
+ newBranches.put(id, samecommit);
+ }
+ branches = newBranches;
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
IFileHistoryProvider fileHistoryProvider = provider
.getFileHistoryProvider();
IFileHistory fileHistoryFor = fileHistoryProvider
@@ -380,7 +452,9 @@ public class GitHistoryPage extends HistoryPage implements IAdaptable,
IFileHistoryProvider.SINGLE_LINE_OF_DESCENT, monitor);
fileRevisions = fileHistoryFor.getFileRevisions();
- final Map fnewappliedPatches = newappliedPatches;
+ final Map fnewappliedPatches = newappliedPatches;
+ final Map<ObjectId,Tag[]> ftags = newtags;
+
tree.getDisplay().asyncExec(new Runnable() {
public void run() {
@@ -389,8 +463,9 @@ public class GitHistoryPage extends HistoryPage implements IAdaptable,
tree.setData(fileRevisions);
tree.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true));
System.out.println("inputchanged, invoking refresh");
- viewer.refresh();
appliedPatches = fnewappliedPatches;
+ tags = ftags;
+ viewer.refresh();
done(Status.OK_STATUS);
}
diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/Repository.java b/org.spearce.jgit/src/org/spearce/jgit/lib/Repository.java
index 3b2a82c..12beb88 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/lib/Repository.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/Repository.java
@@ -470,7 +470,7 @@ public class Repository {
return ref;
}
- public Collection getBranches() {
+ public Collection<String> getBranches() {
return listFilesRecursively(new File(refsDir, "heads"), null);
}
--
1.5.1.1
^ permalink raw reply related
* This week in EGIT - more tags
From: Robin Rosenberg @ 2007-05-13 23:39 UTC (permalink / raw)
To: spearce; +Cc: git
I thought the previous batch was the last 'safe' one, but this one proably
is too as it only adds display of tags and branch to the history view and
no user accessible modifying codde.
In order to do that I had to teach the core more about funny tags and packed
refs.
-- robin
^ permalink raw reply
* [PATCH] Write refs when creating tags
From: Robin Rosenberg @ 2007-05-13 23:39 UTC (permalink / raw)
To: spearce; +Cc: git, Robin Rosenberg
In-Reply-To: <11790995571082-git-send-email-robin.rosenberg@dewire.com>
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
---
org.spearce.jgit/src/org/spearce/jgit/lib/Tag.java | 4 ++--
.../tst/org/spearce/jgit/lib/T0003_Basic.java | 6 +++---
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/Tag.java b/org.spearce.jgit/src/org/spearce/jgit/lib/Tag.java
index d5c6b54..d2a1b2b 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/lib/Tag.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/Tag.java
@@ -128,9 +128,9 @@ public class Tag {
if (tagger!=null || message!=null || type!=null) {
ObjectId tagid = new ObjectWriter(objdb).writeTag(this);
setTagId(tagid);
- objdb.writeRef("refs/heads/"+getTag(),tagid);
+ objdb.writeRef("refs/tags/"+getTag(),tagid);
} else {
- objdb.writeRef("refs/heads/"+getTag(),objId);
+ objdb.writeRef("refs/tags/"+getTag(),objId);
}
}
diff --git a/org.spearce.jgit/tst/org/spearce/jgit/lib/T0003_Basic.java b/org.spearce.jgit/tst/org/spearce/jgit/lib/T0003_Basic.java
index 115e391..2f76907 100644
--- a/org.spearce.jgit/tst/org/spearce/jgit/lib/T0003_Basic.java
+++ b/org.spearce.jgit/tst/org/spearce/jgit/lib/T0003_Basic.java
@@ -331,7 +331,7 @@ public class T0003_Basic extends RepositoryTestCase {
t.tag();
assertEquals("6759556b09fbb4fd8ae5e315134481cc25d46954", t.getTagId().toString());
- Tag mapTag = db.mapTag("6759556b09fbb4fd8ae5e315134481cc25d46954");
+ Tag mapTag = db.mapTag("test020");
assertEquals("blob", mapTag.getType());
assertEquals("test020 tagged\n", mapTag.getMessage());
assertEquals(new PersonIdent(jauthor, 1154236443000L, -4 * 60), mapTag.getAuthor());
@@ -365,7 +365,7 @@ public class T0003_Basic extends RepositoryTestCase {
t.tag();
assertEquals("b0517bc8dbe2096b419d42424cd7030733f4abe5", t.getTagId().toString());
- Tag mapTag = db.mapTag("b0517bc8dbe2096b419d42424cd7030733f4abe5");
+ Tag mapTag = db.mapTag("test021");
assertEquals("tree", mapTag.getType());
assertEquals("test021 tagged\n", mapTag.getMessage());
assertEquals(new PersonIdent(jauthor, 1154236443000L, -4 * 60), mapTag.getAuthor());
@@ -392,7 +392,7 @@ public class T0003_Basic extends RepositoryTestCase {
t.tag();
assertEquals("0ce2ebdb36076ef0b38adbe077a07d43b43e3807", t.getTagId().toString());
- Tag mapTag = db.mapTag("0ce2ebdb36076ef0b38adbe077a07d43b43e3807");
+ Tag mapTag = db.mapTag("test022");
assertEquals("commit", mapTag.getType());
assertEquals("test022 tagged\n", mapTag.getMessage());
assertEquals(new PersonIdent(jauthor, 1154236443000L, -4 * 60), mapTag.getAuthor());
--
1.5.1.1
^ permalink raw reply related
* [PATCH] Implement simple tags
From: Robin Rosenberg @ 2007-05-13 23:39 UTC (permalink / raw)
To: spearce; +Cc: git, Robin Rosenberg
In-Reply-To: <11790995572233-git-send-email-robin.rosenberg@dewire.com>
This is just a reference in <gitdir>/refs/tags with the SHA-1
of the tagged object.
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
---
.../src/org/spearce/jgit/lib/Repository.java | 14 +++++++-------
org.spearce.jgit/src/org/spearce/jgit/lib/Tag.java | 20 ++++++++++++++++----
.../tst/org/spearce/jgit/lib/T0003_Basic.java | 13 +++++++++++++
3 files changed, 36 insertions(+), 11 deletions(-)
diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/Repository.java b/org.spearce.jgit/src/org/spearce/jgit/lib/Repository.java
index 482f41d..76191be 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/lib/Repository.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/Repository.java
@@ -262,17 +262,17 @@ public class Repository {
public Tag mapTag(String revstr) throws IOException {
final ObjectId id = resolve(revstr);
- return id != null ? mapTag(id) : null;
+ return id != null ? mapTag(revstr, id) : null;
}
- public Tag mapTag(final ObjectId id) throws IOException {
+ public Tag mapTag(final String refName, final ObjectId id) throws IOException {
final ObjectLoader or = openObject(id);
if (or == null)
return null;
final byte[] raw = or.getBytes();
if (Constants.TYPE_TAG.equals(or.getType()))
- return new Tag(this, id, raw);
- throw new IncorrectObjectTypeException(id, Constants.TYPE_TAG);
+ return new Tag(this, id, refName, raw);
+ return new Tag(this, id, refName, null);
}
public RefLock lockRef(final String ref) throws IOException {
@@ -469,7 +469,7 @@ public class Repository {
return listFilesRecursively(new File(refsDir, "heads"), null);
}
- public Collection getTags() {
+ public Collection<String> getTags() {
return listFilesRecursively(new File(refsDir, "tags"), null);
}
@@ -535,10 +535,10 @@ public class Repository {
return ret;
}
- private Collection listFilesRecursively(File root, File start) {
+ private Collection<String> listFilesRecursively(File root, File start) {
if (start == null)
start = root;
- Collection ret = new ArrayList();
+ Collection<String> ret = new ArrayList();
File[] files = start.listFiles();
for (int i = 0; i < files.length; ++i) {
if (files[i].isDirectory())
diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/Tag.java b/org.spearce.jgit/src/org/spearce/jgit/lib/Tag.java
index 877c440..d5c6b54 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/lib/Tag.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/Tag.java
@@ -44,10 +44,16 @@ public class Tag {
objdb = db;
}
- public Tag(final Repository db, final ObjectId id, final byte[] raw) {
+ public Tag(final Repository db, final ObjectId id, String refName, final byte[] raw) {
objdb = db;
- tagId = id;
- objId = ObjectId.fromString(raw, 7);
+ if (raw != null) {
+ tagId = id;
+ objId = ObjectId.fromString(raw, 7);
+ } else
+ objId = id;
+ if (refName.startsWith("refs/tags/"))
+ refName = refName.substring(10);
+ tag = refName;
this.raw = raw;
}
@@ -119,7 +125,13 @@ public class Tag {
public void tag() throws IOException {
if (getTagId() != null)
throw new IllegalStateException("exists " + getTagId());
- setTagId(new ObjectWriter(objdb).writeTag(this));
+ if (tagger!=null || message!=null || type!=null) {
+ ObjectId tagid = new ObjectWriter(objdb).writeTag(this);
+ setTagId(tagid);
+ objdb.writeRef("refs/heads/"+getTag(),tagid);
+ } else {
+ objdb.writeRef("refs/heads/"+getTag(),objId);
+ }
}
public String toString() {
diff --git a/org.spearce.jgit/tst/org/spearce/jgit/lib/T0003_Basic.java b/org.spearce.jgit/tst/org/spearce/jgit/lib/T0003_Basic.java
index 0302a45..115e391 100644
--- a/org.spearce.jgit/tst/org/spearce/jgit/lib/T0003_Basic.java
+++ b/org.spearce.jgit/tst/org/spearce/jgit/lib/T0003_Basic.java
@@ -338,6 +338,19 @@ public class T0003_Basic extends RepositoryTestCase {
assertEquals("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", mapTag.getObjId().toString());
}
+ public void test020b_createBlobPlainTag() throws IOException {
+ test020_createBlobTag();
+ Tag t = new Tag(db);
+ t.setTag("test020b");
+ t.setObjId(new ObjectId("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"));
+ t.tag();
+
+ Tag mapTag = db.mapTag("test020b");
+ assertEquals("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", mapTag.getObjId().toString());
+
+ // We do not repeat the plain tag test for other object types
+ }
+
public void test021_createTreeTag() throws IOException {
final ObjectId emptyId = new ObjectWriter(db).writeBlob(new byte[0]);
final Tree almostEmptyTree = new Tree(db);
--
1.5.1.1
^ permalink raw reply related
* [PATCH] Implement packed refs
From: Robin Rosenberg @ 2007-05-13 23:39 UTC (permalink / raw)
To: spearce; +Cc: git, Robin Rosenberg
In-Reply-To: <11790995573817-git-send-email-robin.rosenberg@dewire.com>
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
---
.../src/org/spearce/jgit/lib/Repository.java | 48 +++++++++++++++++++-
.../tst/org/spearce/jgit/lib/T0003_Basic.java | 44 ++++++++++++++++++
2 files changed, 91 insertions(+), 1 deletions(-)
diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/Repository.java b/org.spearce.jgit/src/org/spearce/jgit/lib/Repository.java
index 76191be..3b2a82c 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/lib/Repository.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/Repository.java
@@ -399,6 +399,7 @@ public class Repository {
private Ref readRef(final String revstr, final boolean missingOk)
throws IOException {
+ refreshPackredRefsCache();
for (int k = 0; k < refSearchPaths.length; k++) {
final Ref r = readRefBasic(refSearchPaths[k] + revstr);
if (missingOk || r.getObjectId() != null) {
@@ -411,6 +412,10 @@ public class Repository {
private Ref readRefBasic(String name) throws IOException {
int depth = 0;
REF_READING: do {
+ ObjectId id = packedRefs.get(name);
+ if (id != null)
+ return new Ref(null, id);
+
final File f = new File(getDirectory(), name);
if (!f.isFile()) {
return new Ref(f, null);
@@ -470,7 +475,43 @@ public class Repository {
}
public Collection<String> getTags() {
- return listFilesRecursively(new File(refsDir, "tags"), null);
+ Collection<String> tags = listFilesRecursively(new File(refsDir, "tags"), null);
+ refreshPackredRefsCache();
+ tags.addAll(packedRefs.keySet());
+ return tags;
+ }
+
+ private Map<String,ObjectId> packedRefs = new HashMap<String,ObjectId>();
+ private long packedrefstime = 0;
+
+ private void refreshPackredRefsCache() {
+ File file = new File(gitDir, "packed-refs");
+ if (!file.exists()) {
+ if (packedRefs.size() > 0)
+ packedRefs = new HashMap();
+ return;
+ }
+ if (file.lastModified() == packedrefstime)
+ return;
+ Map newPackedRefs = new HashMap();
+ try {
+ BufferedReader b=new BufferedReader(new FileReader(file));
+ String p;
+ while ((p = b.readLine()) != null) {
+ if (p.charAt(0) == '#')
+ continue;
+ if (p.charAt(0) == '^') {
+ continue;
+ }
+ int spos = p.indexOf(' ');
+ ObjectId id = new ObjectId(p.substring(0,spos));
+ String name = p.substring(spos+1);
+ newPackedRefs.put(name, id);
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ packedRefs = newPackedRefs;
}
/**
@@ -551,4 +592,9 @@ public class Repository {
}
return ret;
}
+
+ /** Clean up stale caches */
+ public void refreshFromDisk() {
+ packedRefs = null;
+ }
}
diff --git a/org.spearce.jgit/tst/org/spearce/jgit/lib/T0003_Basic.java b/org.spearce.jgit/tst/org/spearce/jgit/lib/T0003_Basic.java
index 2f76907..02ecabf 100644
--- a/org.spearce.jgit/tst/org/spearce/jgit/lib/T0003_Basic.java
+++ b/org.spearce.jgit/tst/org/spearce/jgit/lib/T0003_Basic.java
@@ -21,6 +21,7 @@ import java.io.FileInputStream;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
+import java.io.PrintWriter;
public class T0003_Basic extends RepositoryTestCase {
public void test001_Initalize() {
@@ -428,4 +429,47 @@ public class T0003_Basic extends RepositoryTestCase {
ObjectId cid = new ObjectWriter(db).writeCommit(commit);
assertEquals("2979b39d385014b33287054b87f77bcb3ecb5ebf", cid.toString());
}
+
+ public void test025_packedRefs() throws IOException {
+ test020_createBlobTag();
+ test021_createTreeTag();
+ test022_createCommitTag();
+
+ if (!new File(db.getDirectory(),"refs/tags/test020").delete()) throw new Error("Cannot delete unpacked tag");
+ if (!new File(db.getDirectory(),"refs/tags/test021").delete()) throw new Error("Cannot delete unpacked tag");
+ if (!new File(db.getDirectory(),"refs/tags/test022").delete()) throw new Error("Cannot delete unpacked tag");
+
+ // We cannot resolve it now, since we have no ref
+ Tag mapTag20missing = db.mapTag("test020");
+ assertNull(mapTag20missing);
+
+ // Construct packed refs file
+ PrintWriter w = new PrintWriter(new FileWriter(new File(db.getDirectory(), "packed-refs")));
+ w.println("# packed-refs with: peeled");
+ w.println("6759556b09fbb4fd8ae5e315134481cc25d46954 refs/tags/test020");
+ w.println("^e69de29bb2d1d6434b8b29ae775ad8c2e48c5391");
+ w.println("b0517bc8dbe2096b419d42424cd7030733f4abe5 refs/tags/test021");
+ w.println("^417c01c8795a35b8e835113a85a5c0c1c77f67fb");
+ w.println("0ce2ebdb36076ef0b38adbe077a07d43b43e3807 refs/tags/test022");
+ w.println("^b5d3b45a96b340441f5abb9080411705c51cc86c");
+ w.close();
+
+ Tag mapTag20 = db.mapTag("test020");
+ assertEquals("blob", mapTag20.getType());
+ assertEquals("test020 tagged\n", mapTag20.getMessage());
+ assertEquals(new PersonIdent(jauthor, 1154236443000L, -4 * 60), mapTag20.getAuthor());
+ assertEquals("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", mapTag20.getObjId().toString());
+
+ Tag mapTag21 = db.mapTag("test021");
+ assertEquals("tree", mapTag21.getType());
+ assertEquals("test021 tagged\n", mapTag21.getMessage());
+ assertEquals(new PersonIdent(jauthor, 1154236443000L, -4 * 60), mapTag21.getAuthor());
+ assertEquals("417c01c8795a35b8e835113a85a5c0c1c77f67fb", mapTag21.getObjId().toString());
+
+ Tag mapTag22 = db.mapTag("test022");
+ assertEquals("commit", mapTag22.getType());
+ assertEquals("test022 tagged\n", mapTag22.getMessage());
+ assertEquals(new PersonIdent(jauthor, 1154236443000L, -4 * 60), mapTag22.getAuthor());
+ assertEquals("b5d3b45a96b340441f5abb9080411705c51cc86c", mapTag22.getObjId().toString());
+ }
}
--
1.5.1.1
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox