Commit graph

11 commits

Author SHA1 Message Date
Johannes Sixt 32a90233d1 t3701: ensure correctly set up repository after skipped tests
There are two tests that are skipped if file modes are not obeyed by the
file system. In this case, the subsequent test failed because the
repository was in an unexpected state. This corrects it.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-25 11:23:30 -07:00
Junio C Hamano 7a26e65392 Revert "git-add--interactive: remove hunk coalescing"
This reverts commit 0beee4c6de but with a
bit of twist, as we have added "edit hunk manually" hack and we cannot
rely on the original line numbers of the hunks that were manually edited.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-16 18:52:12 -07:00
Matt Graham f67182bf65 Splitting a hunk that adds a line at the top fails in "add -p"
Splitting a hunk into two in add -p doesn't work for a diff that adds a
new line at the top of the file with other add in the same hunk.

Signed-off-by: Matthew Graham <mdg149@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-16 18:52:03 -07:00
Jeff King 1b19ccd236 tests: skip perl tests if NO_PERL is defined
These scripts all test git programs that are written in
perl, and thus obviously won't work if NO_PERL is defined.
We pass NO_PERL to the scripts from the building Makefile
via the GIT-BUILD-OPTIONS file.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-08 22:42:16 -07:00
Johannes Sixt 872f349e7b Skip tests that fail if the executable bit is not handled by the filesystem
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
2009-03-22 17:26:44 +01: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
Alex Riesen 26ec126a91 Fix t3701 if core.filemode disabled
[jc: squashed in suggestions from Jeff King]

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-05-21 11:20:34 -07:00
Jeff King ca7246864b add--interactive: allow user to choose mode update
When using the 'p'atch command, instead of just throwing out any mode
change, present it to the user in the same way that we show hunks.

This way, the mode change can be staged independently from the changes
to the contents.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-27 13:54:57 -07:00
Jeff King b717a62762 add--interactive: ignore mode change in 'p'atch command
When a path is examined in the patch subcommand, any mode changes in
the file are given to use in the diff header by git-diff. If no hunks
are staged, then we throw out that header and do not touch the
path.  But if _any_ hunks are staged, we use the header, and the mode
is changed together with the contents.

Since the 'p'atch command should just be dealing with hunks that are
shown to the user, it makes sense to just ignore mode changes
entirely. We do squirrel away the mode, though, since the next patch
will allow users to select the mode update separately.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-27 13:54:56 -07:00
Jeff King 82ebb0b6ec add test_cmp function for test scripts
Many scripts compare actual and expected output using
"diff -u". This is nicer than "cmp" because the output shows
how the two differ. However, not all versions of diff
understand -u, leading to unnecessary test failure.

This adds a test_cmp function to the test scripts and
switches all "diff -u" invocations to use it. The function
uses the contents of "$GIT_TEST_CMP" to compare its
arguments; the default is "diff -u".

On systems with a less-capable diff, you can do:

  GIT_TEST_CMP=cmp make test

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-13 00:57:52 -07:00
Jeff King 18bc76164d add--interactive: handle initial commit better
There were several points where we looked at the HEAD
commit; for initial commits, this is meaningless. So instead
we:

  - show staged status data as a diff against the empty tree
    instead of HEAD
  - show file diffs as creation events
  - use "git rm --cached" to revert instead of going back to
    the HEAD commit

We magically reference the empty tree to implement this.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-16 01:02:44 -08:00