Commit Graph

214 Commits

Author SHA1 Message Date
Junio C Hamano
bff64a9cda Merge branch 'tr/maint-mailinfo'
* tr/maint-mailinfo:
  mailinfo: with -b, keep space after [foo]
  am: learn passing -b to mailinfo

Conflicts:
	git-am.sh
2012-01-29 13:18:53 -08:00
Thomas Rast
f7e5ea171b am: learn passing -b to mailinfo
git-am could pass -k to mailinfo, but not -b.  Introduce an option
that does so.  We change the meaning of the 'keep' state file, but are
careful not to cause a problem unless you downgrade in the middle of
an 'am' run.

This uncovers a bug in mailinfo -b, hence the failing test.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-01-16 16:04:52 -08:00
Junio C Hamano
10dd3b2bf1 Merge branch 'maint-1.7.7' into maint
* maint-1.7.7:
  am: don't persist keepcr flag
  mingw: give waitpid the correct signature
  git symbolic-ref: documentation fix
2011-12-09 13:33:39 -08:00
Martin von Zweigbergk
7919704254 am: don't persist keepcr flag
The keepcr flag is only used in the split_patches function, which is
only called before a patch application has to stopped for user input,
not after resuming. It is therefore unnecessary to persist the
flag. This seems to have been the case since it was introduced in
ad2c928 (git-am: Add command line parameter `--keep-cr` passing it to
git-mailsplit, 2010-02-27).

Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-12-09 10:49:43 -08:00
Junio C Hamano
79814585b7 Merge branch 'gb/am-hg-patch'
* gb/am-hg-patch:
  am: preliminary support for hg patches
2011-10-05 12:36:17 -07:00
Junio C Hamano
fee6bc5f03 Merge branch 'gb/maint-am-stgit-author-to-from-fix'
* gb/maint-am-stgit-author-to-from-fix:
  am: fix stgit patch mangling
2011-09-02 13:18:11 -07:00
Junio C Hamano
e7734c6c9b Merge branch 'gb/maint-am-patch-format-error-message'
* gb/maint-am-patch-format-error-message:
  am: format is in $patch_format, not parse_patch

Conflicts:
	git-am.sh
2011-09-02 13:18:07 -07:00
Giuseppe Bilotta
0cfd112032 am: preliminary support for hg patches
Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-29 10:21:17 -07:00
Giuseppe Bilotta
45d51dc969 am: fix stgit patch mangling
Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-29 09:51:44 -07:00
Giuseppe Bilotta
dff4b0ef30 am: format is in $patch_format, not parse_patch
The error message given when the patch format was not recognized was
wrong, since the variable checked was $parse_patch rather than
$patch_format. Fix by checking the non-emptyness of the correct
variable.

Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-29 09:07:54 -07:00
Junio C Hamano
957450054c Merge branch 'js/i18n-scripts'
* js/i18n-scripts:
  submodule: take advantage of gettextln and eval_gettextln.
  stash: take advantage of eval_gettextln
  pull: take advantage of eval_gettextln
  git-am: take advantage of gettextln and eval_gettextln.
  gettext: add gettextln, eval_gettextln to encode common idiom
2011-08-25 16:00:16 -07:00
Junio C Hamano
beace29a04 Merge branch 'db/am-skip-blank-at-the-beginning'
* db/am-skip-blank-at-the-beginning:
  am: ignore leading whitespace before patch
2011-08-18 22:07:57 -07:00
Junio C Hamano
d8308c79fc Merge branch 'ma/am-exclude'
* ma/am-exclude:
  am: Document new --exclude=<path> option
  am: pass exclude down to apply
2011-08-18 22:07:54 -07:00
Junio C Hamano
50b68aeb39 Merge branch 'maint'
* maint:
  Prepare for 1.7.6.1
  am: refresh the index at start and --resolved

Conflicts:
	GIT-VERSION-GEN
	RelNotes
2011-08-16 14:22:26 -07:00
Jeff King
2a6f08ac1f am: refresh the index at start and --resolved
If a file is unchanged but stat-dirty, we may erroneously
fail to apply patches, thinking that they conflict with a
dirty working tree.

This patch adds a call to "update-index --refresh". It comes
as late as possible, so that we don't bother with it for
thinks like "git rebase --abort", or when mbox-splitting
fails. However, it does come before we actually start
applying patches, meaning we will only call it once when we
start applying patches (or any time we return to "am" after
having resolved conflicts), and not once per patch.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-16 11:15:41 -07:00
David Barr
0e8341f29d am: ignore leading whitespace before patch
Some web-based email clients prepend whitespace to raw message
transcripts to workaround content-sniffing in some browsers.  Adjust
the patch format detection logic to ignore leading whitespace.

So now you can apply patches from GMail with "git am" in three steps:

 1. choose "show original"
 2. tell the browser to "save as" (for example by pressing Ctrl+S)
 3. run "git am" on the saved file

This fixes a regression introduced by v1.6.4-rc0~15^2~2 (git-am
foreign patch support: autodetect some patch formats, 2009-05-27).
GMail support was first introduced to "git am" by v1.5.4-rc0~274^2
(Make mailsplit and mailinfo strip whitespace from the start of the
input, 2007-11-01).

Signed-off-by: David Barr <davidbarr@google.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-11 13:01:18 -07:00
Jon Seymour
de88c1ceda git-am: take advantage of gettextln and eval_gettextln.
Signed-off-by: Jon Seymour <jon.seymour@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-08 12:04:21 -07:00
maximilian attems
77e9e496a1 am: pass exclude down to apply
This allows to pass patches around from repositories,
where the other repository doesn't feature certain files.

In the special case this works for dash git sync to klibc dash:
 git am --directory="usr/dash" --exclude="usr/dash/configure.ac" \
        --exclude="usr/dash/ChangeLog" --exclude="usr/dash/dash.1" \
	.. -i -s -k ../dash/000X-foo.patch

Signed-off-by: maximilian attems <max@stro.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-03 11:21:46 -07:00
Ævar Arnfjörð Bjarmason
39dc30dc1b i18n: git-am printf(1) message to eval_gettext
Convert a message that used printf(1) format to use eval_gettext. It's
easier for translators to handle the latter, since the eval format
automatically gives them context via variable names.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-21 11:57:15 -07:00
Ævar Arnfjörð Bjarmason
dff1a98350 i18n: git-am core say messages
Make the core git-am messages that use say() translatable. These are
visible on almost every git am invocation.

There are tests that depend on the "Applying" output that need to be
changed to use the test_i18* functions along with this translation.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-21 11:57:14 -07:00
Ævar Arnfjörð Bjarmason
865207a6dd i18n: git-am "Falling back" say message
Make the "Falling back to patching base and 3-way merge..." message
used by fall_back_3way() translatable.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-21 11:57:14 -07:00
Ævar Arnfjörð Bjarmason
7a74d04a46 i18n: git-am "Apply?" message
Make the "Apply? [y]es/[n]o/[e]dit/[v]iew patch/[a]ccept all" message
translatable, and leave a note in a TRANSLATORS comment explaining
that translators have to preserve a mention of the y/n/e/v/a
characters since the program will expect them, and not their
localized equivalents.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-21 11:57:14 -07:00
Ævar Arnfjörð Bjarmason
d62a1461c3 i18n: git-am clean_abort messages
Messages that used the clean_abort function needed both gettext(1) and
eval_gettext(). These need to be interpolated in a string like the die
and cannot_fallback messages.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-21 11:57:14 -07:00
Ævar Arnfjörð Bjarmason
a424ca157f i18n: git-am cannot_fallback messages
Translate messages with gettext(1) before they're passed to the
cannot_fallback function, just like we handle the die function.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-21 11:57:14 -07:00
Ævar Arnfjörð Bjarmason
790872592e i18n: git-am die messages
The die messages in git-am need to use:

    die "$(gettext "string")"

Since gettext(1) emits the message instead of returning it like the C
equivalent, and our die() function in git-sh-setup needs to get a
string as an argument.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-21 11:57:14 -07:00
Ævar Arnfjörð Bjarmason
22fdd11432 i18n: git-am gettext + gettext to stderr message
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-21 11:57:14 -07:00
Ævar Arnfjörð Bjarmason
a4372c373b i18n: git-am eval_gettext messages
Messages that use variables to be interpolated need to use
eval_gettext(), this wrapper will eval the message and expand the
variable for us.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-21 11:57:13 -07:00
Ævar Arnfjörð Bjarmason
bd8643ae51 i18n: git-am multi-line getttext $msg; echo
When we have multi-line `gettext $msg; echo' messages we can't
preserve the existing indenting because gettext(1) can't accept input
on stdin.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-21 11:57:13 -07:00
Ævar Arnfjörð Bjarmason
81dd2fe542 i18n: git-am one-line gettext $msg; echo
One-line `gettext $msg; echo' messages are the simplest use case for
gettext(1).

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-21 11:57:13 -07:00
Ævar Arnfjörð Bjarmason
b9a972691e i18n: git-am add git-sh-i18n
Source git-sh-i18n in git-am.sh, it's needed to import the Git gettext
shell functions.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-21 11:57:13 -07:00
Junio C Hamano
5765870d53 Merge branch 'jc/maint-rebase-rewrite-last-skip'
* jc/maint-rebase-rewrite-last-skip:
  rebase --skip: correctly wrap-up when skipping the last patch
2010-12-28 11:26:59 -08:00
Junio C Hamano
ef88ad2387 rebase --skip: correctly wrap-up when skipping the last patch
When "rebase --skip" is used to skip the last patch in the series, the
code to wrap up the rewrite by copying the notes from old to new commits
and also by running the post-rewrite hook was bypassed.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-22 16:50:28 -08:00
Junio C Hamano
cfa775c10e Merge branch 'jc/maint-am-abort-safely'
* jc/maint-am-abort-safely:
  am --abort: keep unrelated commits since the last failure and warn
2010-12-22 14:41:19 -08:00
Junio C Hamano
7b3b7e3758 am --abort: keep unrelated commits since the last failure and warn
After making commits (either by pulling or doing their own work) after a
failed "am", the user will be reminded by next "am" invocation that there
was a failed "am" that the user needs to decide to resolve or to get rid
of the old "am" attempt.  The "am --abort" option was meant to help the
latter.  However, it rewinded the HEAD back to the beginning of the failed
"am" attempt, discarding commits made (perhaps by mistake) since.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-21 11:16:28 -08:00
Junio C Hamano
d4c4369752 Sync with 1.7.3.2
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-10-21 17:16:10 -07:00
Junio C Hamano
f7bff60de9 Merge branch 'sn/doc-opt-notation' into maint
* sn/doc-opt-notation:
  Fix {update,checkout}-index usage strings
  Put a space between `<' and argument in pack-objects usage string
  Remove stray quotes in --pretty and --format documentation
  Use parentheses and `...' where appropriate
  Fix odd markup in --diff-filter documentation
  Use angles for placeholders consistently
2010-10-21 16:26:42 -07:00
Junio C Hamano
38a18873b2 Merge branch 'maint'
* maint:
  Better advice on using topic branches for kernel development
  Documentation: update implicit "--no-index" behavior in "git diff"
  Documentation: expand 'git diff' SEE ALSO section
  Documentation: diff can compare blobs
  Documentation: gitrevisions is in section 7
  shell portability: no "export VAR=VAL"
  CodingGuidelines: reword parameter expansion section
  Documentation: update-index: -z applies also to --index-info
  Documentation: No argument of ALLOC_GROW should have side-effects
2010-10-13 20:20:09 -07:00
Junio C Hamano
69ae92bda1 shell portability: no "export VAR=VAL"
It is more portable to say "VAR=VAL && export VAR" instead.

Noticed by Ævar.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-10-13 11:36:36 -07:00
Štěpán Němec
0adda9362a Use parentheses and `...' where appropriate
Remove some stray usage of other bracket types and asterisks for the
same purpose.

Signed-off-by: Štěpán Němec <stepnem@gmail.com>
Acked-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-10-08 12:31:07 -07:00
Pat Thoyts
5e9677cbdf git-am: fix detection of absolute paths for windows
Add an is_absolute_path function to abstract out platform differences
in checking for an absolute or relative path.
Specifically fixes t4150-am on Windows.

[PT: updated following suggestion from j6t to support \* and //*]

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
2010-10-03 23:31:59 +01:00
Junio C Hamano
bcdfb20ae9 Merge branch 'js/maint-am-rebase-invalid-author'
* js/maint-am-rebase-invalid-author:
  am: use get_author_ident_from_commit instead of mailinfo when rebasing
2010-06-27 12:07:44 -07:00
Junio C Hamano
8b8063cef3 Merge branch 'rr/am-help'
* rr/am-help:
  git am: Remove stray error message from sed
  git am: Display some help text when patch is empty
  git am: Set cmdline globally
2010-06-18 11:16:56 -07:00
Jay Soffian
43c23251f9 am: use get_author_ident_from_commit instead of mailinfo when rebasing
In certain situations, commit authorship can consist of an invalid
e-mail address. For example, this is the case when working with git svn
repos where the author email has had the svn repo UUID appended such as:

 author@example.com <author@example.com@deadbeef-dead-beef-dead-beefdeadbeef>

Given such an address, mailinfo extracts the authorship incorrectly as
it assumes a valid domain. However, when rebasing the original
authorship should be preserved irrespective of its validity as an email
address.

Using get_author_ident_from_commit instead of mailinfo when rebasing
preserves the original authorship.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-06-16 10:00:58 -07:00
Ramkumar Ramachandra
92f65e6ab6 git am: Remove stray error message from sed
When --continue is invoked without any changes, the following stray
error message appears- sed: can't read $dotest/final-commit: No such
file or directory. Remove this by making sure that the file actually
exists.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-06-02 09:53:45 -07:00
Ramkumar Ramachandra
dc267b1ab4 git am: Display some help text when patch is empty
When a patch is found to be empty, prompt the user to use either
--skip or --abort.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-06-02 09:51:48 -07:00
Ramkumar Ramachandra
d2c4631061 git am: Set cmdline globally
Set the $cmdline variable globally, and not in stop_here_user_resolve
so it can be used in other code fragments as well.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-06-02 09:51:39 -07:00
Jan Krüger
05bdcfe5fc git-am: suggest what to do with superfluous patches
Particularly in the context of rebase, conflicts frequently occur
because the change in the patch to be applied was made obsolete by new
upstream commits. In this case, solving the conflict effectively means
skipping the patch. However, it's not always readily apparent that the
patch needs to be skipped, and when people solve the conflict and try
git rebase --continue, they get confronted with a message of

  No changes - did you forget to use 'git add'?

That's not very helpful if you did actually stage your changes and they
happen to turn the patch into a no-op. This extends the message to point
out what's going on.

Signed-off-by: Jan Krüger <jk@jk.gs>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-05-31 17:48:38 -07:00
Junio C Hamano
edea184a58 Merge branch 'jc/am-3-show-corrupted-patch'
* jc/am-3-show-corrupted-patch:
  am -3: recover the diagnostic messages for corrupt patches
2010-05-21 04:02:18 -07:00
Junio C Hamano
0ba17dd022 am -3: recover the diagnostic messages for corrupt patches
"git am -3" first tries to apply the patch without any extra trick, and
applies it to a synthesized tree for 3-way merge after the first attempt
fails.  "git apply" exits with status 1 for a patch that is well-formed
but is not applicable (and it dies on other errors with non-zereo, non-1
status) and has an optimization to fall back to the 3-way merge only in
the case.

An earlier patch 3ddd170 (am: suppress apply errors when using 3-way,
2009-06-16) squelched diagnostic messages from the first attempt, not to
be shown to the end user.  This worked reasonably well if the reason the
first application failed was because the patch was made against a wrong
version.

When the patch is corrupt (e.g. line-wrapped or leading whitespaces got
dropped), however, because the second patch application is not even
attempted, the error message from the first application is never shown
and is forever lost.  This message is necessary to locate where the patch
is corrupt and fix it up.

We could fix this issue by reverting 3dd170, or keeping the error message
to somewhere and showing it, but because this is an error codepath, the
easiest is to disable the optimization.  The second patch application is
attempted even when the input is corrupt, and it will notice, diagnose,
and stop with an error message.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-04-14 11:20:27 -07:00
Junio C Hamano
a86ed83cce Merge branch 'tr/notes-display'
* tr/notes-display:
  git-notes(1): add a section about the meaning of history
  notes: track whether notes_trees were changed at all
  notes: add shorthand --ref to override GIT_NOTES_REF
  commit --amend: copy notes to the new commit
  rebase: support automatic notes copying
  notes: implement helpers needed for note copying during rewrite
  notes: implement 'git notes copy --stdin'
  rebase -i: invoke post-rewrite hook
  rebase: invoke post-rewrite hook
  commit --amend: invoke post-rewrite hook
  Documentation: document post-rewrite hook
  Support showing notes from more than one notes tree
  test-lib: unset GIT_NOTES_REF to stop it from influencing tests

Conflicts:
	git-am.sh
	refs.c
2010-03-24 16:26:43 -07:00