Commit graph

921 commits

Author SHA1 Message Date
Paul Mackerras 806ce09718 Account for indentation of the checkin comments by git-rev-list
This involves adding indentation when we read a commit with
git-cat-file and trimming the whitespace from the headline.
2005-06-22 18:15:15 +10:00
Linus Torvalds 5c8af185cc git-apply: create subdirectories leading up to a new file
Applying Andrew's latest patch-bomb showed us failing miserably if a new
subdirectory needed to be created..  That said, it's uncommon enough
that it's worth optimistically assuming it won't be needed, and then
creating the subdirectories only on failure.
2005-06-21 19:10:21 -07:00
Daniel Barkalow fa3e0655a4 [PATCH] Pull refs by HTTP
This adds support for refs to http-pull, both the -w option and reading
the target from a served file.

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-21 18:29:13 -07:00
Daniel Barkalow 3173bd4969 [PATCH] Pull misc objects
Make pull fetch whatever is specified, parse it to figure out what it is, and
then process it appropriately. This also supports getting tag objects, and
getting whatever they tag.

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-21 18:29:13 -07:00
Daniel Barkalow 89e4202f98 [PATCH] Parse tags for absent objects
Handle parsing a tag for a non-present object. This adds a function to lookup
an object with lookup_* for * in a string, so that it can get the right storage
based on the "type" line in the tag.

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-21 18:29:12 -07:00
Paul Mackerras b490a99176 Use git-rev-list --header.
With --header, git-rev-list gives us the contents of the commit
in-line, so we don't need to exec a git-cat-file to get it, and we
don't need the readobj command either.
Also fixed a residual problem with handling the commit that
has a parent listed twice.
2005-06-22 10:25:38 +10:00
Linus Torvalds 9661c25640 Fix typo in git-checkout-script.
The confusion between "revs" vs "refs" caused us to not find the branch
name, which in turn meant that we never switched the HEAD over to it.
2005-06-21 17:12:38 -07:00
Linus Torvalds ef0bfa25e9 Remove MERGE_HEAD in "git checkout/reset"
Both of these scripts will end up resetting the index to some specific
head, and any unresolved merge will be forgotten.
2005-06-21 15:40:00 -07:00
Linus Torvalds 6b38a402e9 Clean up different special *HEAD handling
We codify the following different heads (in addition to the main "HEAD",
which points to the current branch, of course):

 - FETCH_HEAD

   Populated by "git fetch"

 - ORIG_HEAD

   The old HEAD before a "git pull/resolve" (successful or not)

 - LAST_MERGE

   The HEAD we're currently merging in "git pull/resolve"

 - MERGE_HEAD

   The previous head of a unresolved "git pull", which gets committed by
   a "git commit" after manually resolving the result

We used to have "MERGE_HEAD" be populated directly by the fetch, and we
removed ORIG_HEAD and LAST_MERGE too aggressively.
2005-06-21 14:04:13 -07:00
Mika Kukkonen d565b3412a [PATCH] Fix several gcc4 signedness warnings
Here is a patch that fixes several gcc4 warnings about different signedness,
all between char and unsigned char. I tried to keep the patch minimal
so resertod to casts in three places.

Signed-off-by: Mika Kukkonen <mikukkon@iki.fi>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-21 13:30:55 -07:00
Linus Torvalds dc14841102 git checkout: fix default head case
The "${new=$old}" syntax only works for an undefined 'new', not for an
empty one. I knew that. Really. I'm not stupid.
2005-06-21 11:14:47 -07:00
Linus Torvalds e8b11749f0 Make "git checkout" know about different branches
Now "git checkout xyzzy" will check out branch "xyzzy" and
switch the HEAD to it.
2005-06-21 11:03:11 -07:00
Linus Torvalds a79944d76c "git checkout": add "-u" flag to update HEAD conditionally
And fix braino on testing "-f".
2005-06-21 09:59:26 -07:00
Linus Torvalds 303e5f4c32 Add "git checkout" that does what the name suggests
It is careful by default and refuses to overwrite old info, but if you
want to force everything to be re-read, use the "-f" flag.

Some day I'll make it take individual filenames too. Right now
it's all-or-nothing.
2005-06-21 09:47:37 -07:00
Nicolas Pitre 83ba99bc8c [PATCH] fix scalability problems with git-deltafy-script
Current version would spin forever and exhaust memory while attempting
to sort all files from all revisions at once, until it dies before even
doing any real work.  This is especially noticeable when used on a big
repository like the imported bkcvs repo for the Linux kernel.

This patch allows for batching the sort to put a bound on needed
resources and making progress early, as well as including some small
cleanups.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-21 08:58:56 -07:00
Sven Verdoolaege 69f956e104 [PATCH] git-apply: Don't barf when --stat'ing a diff with no line changes.
Diffs with only mode changes didn't pass through git-apply --stat.

[ Linus' note: they did for me, on my ppc64, where division by zero just
  silently returns zero.  Duh.  ]

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-21 08:41:56 -07:00
Linus Torvalds 0795495388 Let "git commit" take arguments for files to commit.
It does a "git-update-cache" on the arguments, meaning that you can
commit files without doing a separate "git-update-cache".  This commit
was done with

	git commit git-commit-script

for example.
2005-06-20 21:20:41 -07:00
Linus Torvalds 0ed3715ffc Add "-q" flag to git-update-cache
It suppresses the "needs update" message for subsequent "--refresh"
cases (but not other errors).

Will be useful for "git commit". Stay tuned.
2005-06-20 21:18:54 -07:00
Linus Torvalds 218e441daf Change parent syntax to "xyz^" instead of "xyz.p"
The ".pN" thing might be a common ending of a tag, and in
contrast, ^ already is a special character for revisions
so use that instead.
2005-06-20 21:06:47 -07:00
Linus Torvalds a8be83fe00 Make rev-parse understand "extended sha1" syntax
You can say "HEAD.p" for the "parent of HEAD". It nests, so

	HEAD.p2.p

means parent of second parent of HEAD (which obviously depends
on HEAD being a merge).
2005-06-20 20:28:09 -07:00
Linus Torvalds 6c88be1698 Keep the parents in order when parsing commits
We used to keep the parents in reverse order in the commit_list.  Most
users don't care, but it's wrong, and the next commit does care.
2005-06-20 20:26:03 -07:00
Paul Mackerras 2efef4b9b5 Pass arguments through git-rev-parse.
This allows the user to specify ranges more flexibly; for instance
the user can now do "gitk v2.6.12.." and see all the changes since
2.6.12.
2005-06-21 10:20:04 +10:00
Paul Mackerras a823a91131 Handle the case of a parent being listed twice in a merge.
This happens in the linux-2.6 tree.  We draw the graph line
double-thick to show that this happened.

Also fix a bug where we got a bogus "No commit information available"
line at the end on simple repositories like this one.
2005-06-21 10:01:38 +10:00
Linus Torvalds 9d73fad4ca git-rev-parse: flush "default" head when encountering something unexpected
The unexpected thing is likely a pathname, we need the default for that
too.
2005-06-20 16:14:13 -07:00
Dan Holmsand c591412cc0 [PATCH] git-resolve-script: Add LAST_MERGE and use git-rev-parse
Make git-resolve-script only write MERGE_HEAD if a merge actually
occurred. All merge failures leave ORIG_HEAD and LAST_MERGE
behind (instead of ORIG_HEAD and MERGE_HEAD).

Use git-rev-parse to expand arguments (and check for bad ones).

Signed-off-by: Dan Holmsand <holmsand@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-20 15:49:39 -07:00
Linus Torvalds 800644c5cb git-rev-parse: parse ".." before simple SHA1's
This fixes "<hexsha1>..*", since get_sha1() will happily ignore any
garbage at the end and thus we never got to the ".." check before.
2005-06-20 08:29:13 -07:00
Linus Torvalds fc4263ce4b Avoid gcc warning in diff-stages.c
Put explicit parentheses around && in ||-expression.
2005-06-19 20:15:22 -07:00
Jon Seymour 5e749e259b [PATCH] Fix for --merge-order, --max-age interaction issue
This patch fixes a problem reported by Paul Mackerras regarding the interaction
of the --merge-order and --max-age switches of git-rev-list.

This patch applies to the current Linus HEAD. A cleaner fix for the same problem
in my current HEAD will follow later.

With this change, --merge-order produces the same result as no --merge-order
on the linux-2.6 git repository, to wit:

$> git-rev-list --max-age=1116330140 bcfff0b471a60df350338bcd727fc9b8a6aa54b2 | wc -l
655
$> git-rev-list --merge-order --max-age=1116330140 bcfff0b471a60df350338bcd727fc9b8a6aa54b2 | wc -l
655

Signed-off-by: Jon Seymour <jon.seymour@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-19 20:13:18 -07:00
Jon Seymour 51b1e1713b [PATCH] Prevent git-rev-list without --merge-order producing duplicates in output
If b is reachable from a, then:

	 git-rev-list a b

argument would print one of the commits twice.

This patch fixes that problem. A previous problem fixed it for the
--merge-order switch.

Signed-off-by: Jon Seymour <jon.seymour@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-19 20:13:18 -07:00
Jon Seymour eff19d5ecc [PATCH] Prevent git-rev-list --merge-order producing duplicates in the output
If a is reachable from b, then git-rev-list --merge-order b a would
produce a duplicate output of b.

This causes a problem for an upcoming version of gitk since it
breaks the --merge-order ordering invariant.

This patch fixes the problem for the --merge-order switch. A subsequent
patch will fix the problem for the non --merge-order switch.

Signed-off-by: Jon Seymour <jon.seymour@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-19 20:13:18 -07:00
Jon Seymour c3c1163137 [PATCH] Relaxes error checking in epoch.c to allow duplicate parents
Given that real trees in the wild include parents with duplicate parents, I have relaxed
over-zealous error checking in epoch.c and dealt with the problem a different way - duplicate
parents are now silently ignored.

Signed-off-by: Jon Seymour <jon.seymour@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-19 20:13:18 -07:00
Jon Seymour d6bd56a0e2 [PATCH] Fixes problem with --merge-order head ^head
git-rev-list --merge-order HEAD ^HEAD was faulting rather than generating an empty output.

This patch fixes that problem.

Signed-off-by: Jon Seymour <jon.seymour@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-19 20:13:18 -07:00
Jon Seymour 8cd1033e10 [PATCH] Tweaked --merge-order --show-breaks output in case specified head has no parent
git-rev-list --merge-order --show-breaks root

Was outputing:

| root

It now outputs:

= root

Which is consistent with the behaviour of other cases.

Signed-off-by: Jon Seymour <jon.seymour@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-19 20:13:18 -07:00
Jon Seymour dec5eda786 [PATCH] Additional git-rev-list unit tests to demonstrate problems that require fixes
1. --merge-order doesn't deal properly with a specified head that has no parent

   * FAIL 11: head has no parent

2. --merge-order doesn't deal properly with arguments of the form
     head ^head

   * FAIL 30: head ^head --merge-order git-rev-list --merge-order
     --show-breaks a3 ^a3

3. if one of the specified heads is reachable from the other, the
   head gets printed twice and this causes problems for upcoming
   versions of gitk. This is true for both --merge-order and non
   --merge-order style of invocations.
    * FAIL 24: one specified head reachable from another a4, c3, --merge-order
    * FAIL 26: one specified head reachable from another a4, c3, no --merge-order
    * FAIL 27: one specified head reachable from another c3, a4, no --merge-order

4. --merge-order aborts with commits that list the same parent twice...it should handle it more gracefully.
    * no longer unit testable

5. broken interaction between --merge-order and --max-age
   previously posted as:

    "[PATCH 1/2] Test case that demonstrates problem with --merge-order, --max-age interaction"
    * FAIL 23: --max-age=c3, --merge-order

Later patches in this patch set fix these problems.

Signed-off-by: Jon Seymour <jon.seymour@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-19 20:13:18 -07:00
Junio C Hamano 366175ef8c [PATCH] Rework -B output.
Patch for a completely rewritten file detected by the -B flag
was shown as a pair of creation followed by deletion in earlier
versions.  This was an misguided attempt to make reviewing such
a complete rewrite easier, and unnecessarily ended up confusing
git-apply.  Instead, show the entire contents of old version
prefixed with '-', followed by the entire contents of new
version prefixed with '+'.  This gives the same easy-to-review
for human consumer while keeping it a single, regular
modification patch for machine consumption, something that even
GNU patch can grok.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-19 20:13:18 -07:00
Junio C Hamano 232b75ab3d [PATCH] Update diff documentation.
This updates diff documentation to discuss --find-copies-harder,
and adds descriptions for options that were not described
earlier.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-19 20:13:18 -07:00
Junio C Hamano 4727f64003 [PATCH] Make -C less eager.
Like diff-tree, this patch makes -C option for diff-* brothers
to use only pre-image of modified files as rename/copy detection
by default.  Give --find-copies-harder to use unmodified files
to find copies from as well.

This also fixes "diff-files -C" problem earlier noticed by
Linus.  It was feeding the null sha1 even when the file in the
work tree was known to match what is in the index file.  This
resulted in diff-files showing everything in the project.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-19 20:13:18 -07:00
Linus Torvalds 170241b7d1 Make "git commit" clean up after itself
Noted by Jeff.
2005-06-19 19:57:01 -07:00
Linus Torvalds 55a716cc8c Clean up MERGE_HEAD and ORIG_HEAD also for the trivial fast-forward merges.
Otherwise you'll be bitten by a stale MERGE_HEAD like Jeff was..
2005-06-19 19:42:21 -07:00
Panagiotis Issaris 31b6d200d6 [PATCH] cvs2git.c: support incremental conversion
Add -u option to indicate incremental conversion.

I wanted to be able to track CVS repositories in a GIT repository.  The
cvs2git program worked fine with the initial import but needed a tiny
modification to enable me to resync the GIT repository with the updated
CVS tree.

[ The original version of this patch failed to track the correct
  branch on the first new commit. Fixed and tested by Sven. ]

Signed-off-by: Panagiotis Issaris <takis@lumumba.luc.ac.be>
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-19 10:48:41 -07:00
Sven Verdoolaege 44ab20cd88 [PATCH] ssh-push.c: Fix handling of ssh://host/path URLs
Previous patch to fix host:path notation broke
handling of ssh://host/path notation.

Signed-off-by: Sven Verdoolaege <skimo@liacs.nl>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-19 10:48:41 -07:00
Linus Torvalds b389237ae8 git-commit-tree: ignore duplicate parents
But warn about them.  If somebody really ends up later wanting to
explicitly add a note that something has the same parent twice (who
knows, there are strange people around), we can add a flag to say that
it's expected and ok.

This was brought on by a commit in the kernel tree, where a repeated
merge caused a duplicate parent.

Parent duplicates aren't "wrong" per se, they're just in practice not
something you are ever interested in.
2005-06-19 10:40:10 -07:00
Linus Torvalds 1c107dc422 Fix up INSTALL and "git add"
As suggested by Junio
2005-06-18 23:44:54 -07:00
Linus Torvalds 2160a025d2 read-cache.c: remove stray debugging printf
Pointed out by Junio, part of my debugging of the rewrite of the
file/dir conflict handling.
2005-06-18 23:34:12 -07:00
Linus Torvalds 12676608fe Re-implement "check_file_directory_conflict()"
This is (imho) more readable, and is also a lot faster.  The expense of
looking up sub-directory beginnings was killing us on things like
"git-diff-cache", even though that one didn't even care at all about the
file vs directory conflicts.

We really only care when somebody tries to add a conflicting name to
stage 0.

We should go through the conflict rules more carefully some day.
2005-06-18 20:21:34 -07:00
Linus Torvalds 3d958064e0 Avoid warning about function without return.
Strangely, this warning only shows up when not compiling with "-O2",
which is why I didn't see it originally.
2005-06-18 20:02:49 -07:00
Sven Verdoolaege deb153a75a [PATCH] cvs2git and file permissions
git-cvs2git: propagate mode information

Let cvs checkout in a temporary directory rather than
using the pipe option to avoid loss of mode information.

Signed-off-by: Sven Verdoolaege <skimo@liacs.nl>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-18 15:38:23 -07:00
Linus Torvalds 28342a5d32 Make "pretty" commit logs always show merge information
Otherwise the "git log" information doesn't tell enough to make sense of
a merge.

I'll need to add some parent information for regular entries too, I
think, but the merge is more important.
2005-06-18 13:52:05 -07:00
Linus Torvalds 8b3a1e056f git-rev-list: add "--bisect" flag to find the "halfway" point
This is useful for doing binary searching for problems.  You start with
a known good and known bad point, and you then test the "halfway" point
in between:

	git-rev-list --bisect bad ^good

and you test that.  If that one tests good, you now still have a known
bad case, but two known good points, and you can bisect again:

	git-rev-list --bisect bad ^good1 ^good2

and test that point.  If that point is bad, you now use that as your
known-bad starting point:

	git-rev-list --bisect newbad ^good1 ^good2

and basically at every iteration you shrink your list of commits by
half: you're binary searching for the point where the troubles started,
even though there isn't a nice linear ordering.
2005-06-17 22:54:50 -07:00
Linus Torvalds 753fd78458 Use "-M" instead of "-C" for "git diff" and "git status"
The "C" in "-C" may stand for "Cool", but it's also pretty slow, since
right now it leaves all unmodified files to be tested even if there are
no new files at all.  That just ends up being unacceptably slow for big
projects, especially if it's not all in the cache.
2005-06-17 15:34:19 -07:00