Commit Graph

1776 Commits

Author SHA1 Message Date
Stephan Beyer
5352a82bab t3404: test two "preserve merges with -p" cases
There are two cases for preserving merges:

  1. The merge base is outside the trunk that is to be rebased.
     Then commits of those other parents must not be picked.

  2. The merge base is inside the trunk that is to be rebased.
     Then all the commits related to that merge must be picked
     and the merge must be redone.

The "preserve merges with -p" test case tested for case 1 only.
This patch adds case 2.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-13 16:08:27 -07:00
Junio C Hamano
447d0cca45 Merge branch 'maint' to sync with 1.5.6.3
* maint:
  GIT 1.5.6.3
  git-am: Do not exit silently if committer is unset
  t0004: fix timing bug
  git-mailinfo: document the -n option
  Fix backwards-incompatible handling of core.sharedRepository
2008-07-13 15:45:38 -07:00
Junio C Hamano
671d322035 Merge branch 'am/stash-branch'
* am/stash-branch:
  Add a test for "git stash branch"
  Implement "git stash branch <newbranch> <stash>"
2008-07-13 15:16:09 -07:00
Junio C Hamano
e636799b4d Merge branch 'jc/report-tracking'
* jc/report-tracking:
  branch -r -v: do not spit out garbage
  stat_tracking_info(): clear object flags used during counting
  git-branch -v: show the remote tracking statistics
  git-status: show the remote tracking statistics
  Refactor "tracking statistics" code used by "git checkout"
2008-07-13 15:15:23 -07:00
Junio C Hamano
fc062aa2e1 Merge branch 'js/pick-root'
* js/pick-root:
  Allow cherry-picking root commits
2008-07-13 15:15:13 -07:00
Junio C Hamano
69b060c84e Merge branch 'tr/add-i-e'
* tr/add-i-e:
  git-add--interactive: manual hunk editing mode
  git-add--interactive: remove hunk coalescing
  git-add--interactive: replace hunk recounting with apply --recount
2008-07-13 15:14:59 -07:00
Junio C Hamano
329636b435 t0004: fix timing bug
The test created an initial commit, made .git/objects unwritable and then
exercised various codepaths to create loose commit, tree and blob objects
to make sure the commands notice failures from these attempts.

However, the initial commit was not preceded with test_tick, which made
its object name depend on the timestamp.  The names of all the later tree
and blob objects the test tried to create were static.  If the initial
commit's object name happened to begin with the same two hexdigits as the
tree or blob objects the test later attempted to create, the fan-out
directory in which these tree or blob would be created is already created
when the initial commit was made, and the object creation succeeds, and
commands being tested should not notice any failure --- in short, the test
was bogus.

This makes the fan-out directories also unwritable, and adds test_tick
before the commit object creation to make the test repeatable.

The contents of the file to create a blob from "a" to "60" is to force the
name of the blob object to begin with "1b", which shares the fan-out
directory with the initial commit that is created with the test.  This was
useful when diagnosing the breakage of this test.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-12 04:15:56 -07:00
Petr Baudis
8c6202d869 Fix backwards-incompatible handling of core.sharedRepository
06cbe85 (Make core.sharedRepository more generic, 2008-04-16) broke the
traditional setting of core.sharedRepository to true, which was to make
the repository group writable: with umask 022, it would clear the
permission bits for 'other'. (umask 002 did not exhibit this behaviour
since pre-chmod() check in adjust_shared_perm() fails in that case.)

The call to adjust_shared_perm() should only loosen the permission.
If the user has umask like 022 or 002 that allow others to read, the
resulting files should be made readable and writable by group, without
restricting the readability by others.

This patch fixes the adjust_shared_perm() mode tweak based on Junio's
suggestion and adds the appropriate tests to t/t1301-shared-repo.sh.

Cc: Heikki Orsila <heikki.orsila@iki.fi>
Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-11 20:38:30 -07:00
Junio C Hamano
a9a3e82e6d apply: fix copy/rename breakage
7ebd52a (Merge branch 'dz/apply-again', 2008-07-01) taught "git-apply" to
grok a (non-git) patch that is a concatenation of separate patches that
touch the same file number of times, by recording the postimage of patch
application of previous round and using it as the preimage for later
rounds.

This "incremental" mode of patch application fundamentally contradicts
with the way git rename/copy patches are designed.  When a git patch talks
about a file A getting modified, and a new file B created out of A, like
this:

	diff --git a/A b/A
	--- a/A
	+++ b/A
	... change text here ...
	diff --git a/A b/B
	copy from A
	copy to B
	--- a/A
	+++ b/B
	... change text here ...

the second change to produce B does not depend on what is done to A with
the first change in any way.  This is explicitly done so for reviewability
of individual patches.

With this commit, we do not look at 'fn_table' that records the postimage
of previous round when applying a patch to produce a new file out of an
existing file.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-09 20:31:44 -07:00
Junio C Hamano
e9a9d6edee Merge branch 'js/apply-root'
* js/apply-root:
  git-apply --directory: make --root more similar to GNU diff
  apply --root: thinkofix.
  Teach "git apply" to prepend a prefix with "--root=<root>"
2008-07-09 16:58:21 -07:00
Ramsay Jones
952182b569 t9100-git-svn-basic.sh: Fix determination of utf-8 locale
When setting the GIT_SVN_LC_ALL variable, default to the $LANG
environment variable, when the $LC_ALL override is not set.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-09 14:51:30 -07:00
Ramsay Jones
c6955fec54 t9113-*.sh: provide user feedback when test skipped
Currently this test simply exits without providing any
feedback at all.  Tell user if the test is being skipped
and provide a hint as to how the test may be enabled.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-09 14:51:23 -07:00
Junio C Hamano
bb293b831b Merge branch 'maint'
* maint:
  Start preparing release notes for 1.5.6.3
  git-submodule - Fix bugs in adding an existing repo as a module
  bash: offer only paths after '--'
  Remove unnecessary pack-*.keep file after successful git-clone
  make deleting a missing ref more quiet
2008-07-09 00:19:50 -07:00
Mike Hommey
603fb11682 Avoid apache complaining about lack of server's FQDN
On some setups, apache will say:
apache2: Could not reliably determine the server's fully qualified
domain name, using $(IP_address) for ServerName

Avoid this message polluting tests output by setting a ServerName in
apache configuration.

Signed-off-by: Mike Hommey <mh@glandium.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-08 22:50:48 -07:00
Mike Hommey
9608626282 Skip t5540-http-push test when USE_CURL_MULTI is undefined
When USE_CURL_MULTI is undefined, git http-push doesn't work, so it's
useless to test it.

Signed-off-by: Mike Hommey <mh@glandium.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-08 22:50:14 -07:00
Mike Hommey
13b5481ed8 Fix http-push test
http-push test has been broken by 4a7aaccd adding a space character
in the place where the test is being run.

Signed-off-by: Mike Hommey <mh@glandium.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-08 22:49:42 -07:00
Mike Hommey
b5cd2d1e92 Catch failures from t5540-http-push
git http-push doesn't handle packed-refs, and now the new builtin-clone
created packed refs, the http-push test fails.

Mark the current failure as such, and also catch third test's failure
that went unreported because git push doesn't return an error code when
it says:
 No refs in common and none specified; doing nothing.
Which it does when http-push can't get a list of refs recursively from
$URL/refs/.

Signed-off-by: Mike Hommey <mh@glandium.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-08 22:48:10 -07:00
Brandon Casey
e896912c5e t7701-repack-unpack-unreachable.sh: check timestamp of unpacked objects
Unpacked objects should receive the timestamp of the pack they were
unpacked from. Check.

Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-08 16:56:07 -07:00
Shawn O. Pearce
1db4a75c8d Remove unnecessary pack-*.keep file after successful git-clone
Once a clone is successful we no longer need to hold onto the
.keep file created by the transport.  Delete the file so we
can later repack the complete repository.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-08 14:47:04 -07:00
Jeff King
d1a4489a56 avoid null SHA1 in oldest reflog
When the user specifies a ref by a reflog entry older than
one we have (e.g., "HEAD@{20 years ago"}), we issue a
warning and give them the "from" value of the oldest reflog
entry. That is, we say "we don't know what happened before
this entry, but before this we know we had some particular
SHA1".

However, the oldest reflog entry is often a creation event
such as clone or branch creation. In this case, the entry
claims that the ref went from "00000..." (the null sha1) to
the new value, and the reflog lookup returns the null sha1.

While this is technically correct (the entry tells us that
the ref didn't exist at the specified time) it is not
terribly useful to the end user. What they probably want
instead is "the oldest useful sha1 that this ref ever had".
This patch changes the behavior such that if the oldest ref
would return the null sha1, it instead returns the first
value the ref ever had.

We never discovered this problem in the test scripts because
we created "fake" reflogs that had only a specified segment
of history. This patch updates the tests with a creation
event at the beginning of history.

Signed-off-by: Jeff King <peff@peff.net>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-08 13:57:27 -07:00
Jeff King
0b294c0abf make deleting a missing ref more quiet
If git attempts to delete a ref, but the unlink of the ref
file fails, we print a message to stderr. This is usually a
good thing, but if the error is ENOENT, then it indicates
that the ref has _already_ been deleted. And since that's
our goal, it doesn't make sense to complain to the user.

This harmonizes the error reporting behavior for the
unpacked and packed cases; the packed case already printed
nothing on ENOENT, but the unpacked printed unconditionally.

Additionally, send-pack would, when deleting the tracking
ref corresponding to a remote delete, print "Failed to
delete" on any failure. This can be a misleading
message, since we actually _did_ delete at the remote side,
but we failed to delete locally. Rather than make the
message more precise, let's just eliminate it entirely; the
delete_ref routine already takes care of printing out a much
more specific message about what went wrong.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-08 13:05:11 -07:00
Johannes Schindelin
f95ebf7429 Allow cherry-picking root commits
A root commit couldn't be cherry-picked.  But its semantics can be
defined as simply merging two trees by overlaying disjoint parts
and merging overlapping files without any common ancestor.  You
should be able to rebase originally independent branches on top of
another branch by using this.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-07 13:23:42 -07:00
Junio C Hamano
86d7244321 Merge branch 'jc/rerere'
* jc/rerere:
  rerere.autoupdate
  t4200: fix rerere test
  rerere: remove dubious "tail_optimization"
  git-rerere: detect unparsable conflicts
  rerere: rerere_created_at() and has_resolution() abstraction
2008-07-07 02:17:28 -07:00
Junio C Hamano
17d778e710 Merge branch 'dr/ceiling'
* dr/ceiling:
  Eliminate an unnecessary chdir("..")
  Add support for GIT_CEILING_DIRECTORIES
  Fold test-absolute-path into test-path-utils
  Implement normalize_absolute_path

Conflicts:

	cache.h
	setup.c
2008-07-07 02:17:23 -07:00
Abhijit Menon-Sen
4a588075c5 Add a test for "git stash branch"
Make sure that applying the stash to a new branch after a conflicting
change doesn't result in an error when you try to commit.

Signed-off-by: Abhijit Menon-Sen <ams@toroid.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-06 22:58:56 -07:00
Junio C Hamano
f556388747 git-apply --directory: make --root more similar to GNU diff
Applying a patch in the directory that is different from what the patch
records is done with --directory option in GNU diff.  The --root option we
introduced previously does the same, and we can call it the same way to
give users more familiar feel.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-06 19:33:08 -07:00
Thomas Rast
6cf91492d9 Fix apply --recount handling of no-EOL line
If a patch modifies the last line of a file that previously had no
terminating '\n', it looks like

    -old text
    \ No newline at end of file
    +new text

Hence, a '\' line does not signal the end of the hunk.  This modifies
'git apply --recount' to take this into account.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-05 00:37:44 -07:00
Junio C Hamano
7dde4bb367 Merge branch 'maint'
* maint:
  GIT 1.5.6.2
  Fix executable bits in t/ scripts
  Work around gcc warnings from curl headers
2008-07-04 01:59:57 -07:00
Junio C Hamano
2b2828b452 Fix executable bits in t/ scripts
Pointed out by Ramsay Jones.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-04 01:38:41 -07:00
Johannes Sixt
41872fd573 t4127-apply-same-fn: Avoid sed -i
Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-04 01:36:25 -07:00
Junio C Hamano
c0234b2ef6 stat_tracking_info(): clear object flags used during counting
When left-right traversal counts the commits in a diverged history, it
leaves the flags in the commits smudged, and we need to clear them before
we return.  Otherwise the caller cannot inspect other branches with this
function again.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-03 12:14:53 -07:00
Junio C Hamano
7d3580d74c Merge branch 'maint'
* maint:
  Fix describe --tags --long so it does not segfault
2008-07-02 21:57:50 -07:00
Junio C Hamano
4df0d7af6b Merge branch 'jc/maint-reset' into maint
* jc/maint-reset:
  Allow "git-reset path" when unambiguous
2008-07-02 21:32:44 -07:00
Shawn O. Pearce
14d4642e2a Fix describe --tags --long so it does not segfault
If we match a lightweight (non-annotated tag) as the name to
output and --long was requested we do not have a tag, nor do
we have a tagged object to display.  Instead we must use the
object we were passed as input for the long format display.

Reported-by: Mark Burton <markb@ordern.com>
Backtraced-by: Mikael Magnusson <mikachu@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-02 21:21:59 -07:00
Thomas Rast
ac083c47ea git-add--interactive: manual hunk editing mode
Adds a new option 'e' to the 'add -p' command loop that lets you edit
the current hunk in your favourite editor.

If the resulting patch applies cleanly, the edited hunk will
immediately be marked for staging. If it does not apply cleanly, you
will be given an opportunity to edit again. If all lines of the hunk
are removed, then the edit is aborted and the hunk is left unchanged.

Applying the changed hunk(s) relies on Johannes Schindelin's new
--recount option for git-apply.

Note that the "real patch" test intentionally uses
  (echo e; echo n; echo d) | git add -p
even though the 'n' and 'd' are superfluous at first sight.  They
serve to get out of the interaction loop if git add -p wrongly
concludes the patch does not apply.

Many thanks to Jeff King <peff@peff.net> for lots of help and
suggestions.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-02 15:31:49 -07:00
Junio C Hamano
8ee4a6c2ec apply --root: thinkofix.
The end of a string is string[length-1], not string[length+1].
I pointed it out during the review, but I forgot about it when applying the
patch.  This should fix it.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-02 15:28:22 -07:00
Johannes Schindelin
c4730f35cc Teach "git apply" to prepend a prefix with "--root=<root>"
With "git apply --root=<root>", all file names in the patch are prepended
with <root>.  If a "-p" value was given, the paths are stripped _before_
prepending <root>.

Wished for by HPA.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-01 18:04:28 -07:00
Junio C Hamano
27158e463a Merge branch 'js/apply-recount'
* js/apply-recount:
  Allow git-apply to recount the lines in a hunk (AKA recountdiff)
2008-07-01 16:22:39 -07:00
Junio C Hamano
d4b76e15ea Merge branch 'jc/checkdiff'
* jc/checkdiff:
  Fix t4017-diff-retval for white-space from wc
  Update sample pre-commit hook to use "diff --check"
  diff --check: detect leftover conflict markers
  Teach "diff --check" about new blank lines at end
  checkdiff: pass diff_options to the callback
  check_and_emit_line(): rename and refactor
  diff --check: explain why we do not care whether old side is binary
2008-07-01 16:22:35 -07:00
Junio C Hamano
24cd49f627 Merge branch 'jc/maint-reset'
* jc/maint-reset:
  Allow "git-reset path" when unambiguous
2008-07-01 16:22:19 -07:00
Junio C Hamano
7ebd52aa0e Merge branch 'dz/apply-again'
* dz/apply-again:
  git-apply: handle a patch that touches the same path more than once better
2008-07-01 16:22:10 -07:00
Brian Gernhardt
f9d800e207 Add test results directory to t/.gitignore
We don't need test results to be committed if we're fixing a test.

Signed-off-by: Brian Gernhardt <benji@silverinsanity.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-30 00:36:39 -07:00
Junio C Hamano
e46f9c8161 t9700: skip when Test::More is not available
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-29 23:28:44 -07:00
Brian Gernhardt
ab20fda992 Fix t4017-diff-retval for white-space from wc
Signed-off-by: Brian Gernhardt <benji@silverinsanity.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-29 15:11:50 -07:00
Johannes Schindelin
c14b9d1e33 Allow git-apply to recount the lines in a hunk (AKA recountdiff)
Sometimes, the easiest way to fix up a patch is to edit it directly, even
adding or deleting lines.  Now, many people are not as divine as certain
benevolent dictators as to update the hunk headers correctly at the first
try.

So teach the tool to do it for us.

[jc: with tests]

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-28 01:19:42 -07:00
Don Zickus
7a07841c0b git-apply: handle a patch that touches the same path more than once better
When working with a lot of people who backport patches all day long, every
once in a while I get a patch that modifies the same file more than once
inside the same patch.  git-apply either fails if the second change relies
on the first change or silently drops the first change if the second change
is independent.

The silent part is the scary scenario for us.  Also this behaviour is
different from the patch-utils.

I have modified git-apply to create a table of the filenames of files it
modifies such that if a later patch chunk modifies a file in the table it
will buffer the previously changed file instead of reading the original file
from disk.

Logic has been put in to handle creations/deletions/renames/copies.  All the
relevant tests of git-apply succeed.

A new test has been added to cover the cases I addressed.

The fix is relatively straight-forward.

Signed-off-by: Don Zickus <dzickus@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-27 17:01:02 -07:00
Junio C Hamano
049540435f diff --check: detect leftover conflict markers
This teaches "diff --check" to detect and complain if the change
adds lines that look like leftover conflict markers.

We should be able to remove the old Perl script used in the sample
pre-commit hook and modernize the script with this facility.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-26 22:07:54 -07:00
Junio C Hamano
877f23ccb8 Teach "diff --check" about new blank lines at end
When a patch adds new blank lines at the end, "git apply --whitespace"
warns.  This teaches "diff --check" to do the same.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-26 22:07:26 -07:00
Lea Wiemann
4c7ba956a3 test-lib.sh: show git init output when in verbose mode
Signed-off-by: Lea Wiemann <LeWiemann@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-26 18:28:55 -07:00
Junio C Hamano
c0f5c69c68 Merge branch 'maint'
* maint:
  GIT 1.5.5.5
  GIT 1.5.4.6
  git-shell: accept "git foo" form
  diff --check: do not discard error status upon seeing a good line
2008-06-26 18:12:47 -07:00