git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [ANNOUNCE] Git 1.7.4.3
@ 2011-04-03  8:36 Junio C Hamano
  2011-04-06 18:40 ` Arnaud Lacombe
  0 siblings, 1 reply; 6+ messages in thread
From: Junio C Hamano @ 2011-04-03  8:36 UTC (permalink / raw)
  To: git

The latest maintenance release Git 1.7.4.3 is available at the
usual places:

  http://www.kernel.org/pub/software/scm/git/

  git-1.7.4.3.tar.{gz,bz2}			(source tarball)
  git-htmldocs-1.7.4.3.tar.{gz,bz2}		(preformatted docs)
  git-manpages-1.7.4.3.tar.{gz,bz2}		(preformatted docs)

The RPM binary packages for a few architectures are found in:

  RPMS/$arch/git-*-1.7.4.3-1.fc13.$arch.rpm	(RPM)

Git v1.7.4.3 Release Notes
==========================

Fixes since v1.7.4.2
--------------------

 * "git apply" used to confuse lines updated by previous hunks as lines
   that existed before when applying a hunk, contributing misapplication
   of patches with offsets.

 * "git branch --track" (and "git checkout --track --branch") used to
   allow setting up a random non-branch that does not make sense to follow
   as the "upstream".  The command correctly diagnoses it as an error.

 * "git checkout $other_branch" silently removed untracked symbolic links
   in the working tree that are in the way in order to check out paths
   under it from the named branch.

 * "git cvsimport" did not bail out immediately when the cvs server cannot
   be reached, spewing unnecessary error messages that complain about the
   server response that it never got.

 * "git diff --quiet" did not work very well with the "--diff-filter"
   option.

 * "git grep -n" lacked a long-hand synonym --line-number.

 * "git stash apply" reported the result of its operation by running
   "git status" from the top-level of the working tree; it should (and
   now does) run it from the user's working directory.

And other minor fixes and documentation updates.

----------------------------------------------------------------

Changes since v1.7.4.2 are as follows:

Alex Riesen (1):
      HOME must be set before calling git-init when creating test repositories

Carlos Martín Nieto (1):
      Documentation/config.txt: make truth value of numbers more explicit

Clemens Buchacher (1):
      do not overwrite untracked symlinks

Fabian Keil (1):
      git-cvsimport.perl: Bail out right away when reading from the server fails

Jeff King (1):
      docs: fix filter-branch subdir example for exotic repo names

Joe Ratterman (1):
      grep: Add the option '--line-number'

Johan Herland (1):
      branch/checkout --track: Ensure that upstream branch is indeed a branch

Johannes Sixt (3):
      Demonstrate breakage: checkout overwrites untracked symlink with directory
      stash: fix incorrect quoting in cleanup of temporary files
      stash: copy the index using --index-output instead of cp -p

Junio C Hamano (9):
      checkout: fix bug with ambiguous refs
      apply: do not patch lines that were already patched
      apply -v: show offset count when patch did not apply exactly
      diff --quiet: disable optimization when --diff-filter=X is used
      doc: technical details about the index file format
      t8001: check the exit status of the command being tested
      parse-remote: typofix
      Doc: mention --delta-base-offset is the default for Porcelain commands
      Git 1.7.4.3

Maxin john (1):
      contrib/thunderbird-patch-inline: do not require bash to run the script

Michael J Gruber (2):
      git-bisect.txt: streamline run presentation
      git-bisect.txt: example for bisecting with hot-fix

Michael Witten (3):
      git tag documentation grammar fixes and readability updates
      Typos: t/README
      strbuf.h: remove a tad stale docs-in-comment and reference api-doc instead

Nguyễn Thái Ngọc Duy (1):
      doc: technical details about the index file format

Piotr Krukowiecki (2):
      git stash: show status relative to current directory
      Add test: git stash shows status relative to current dir

Stephen Boyd (2):
      parse-remote: replace unnecessary sed invocation
      git-pack-objects.txt: fix grammatical errors

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [ANNOUNCE] Git 1.7.4.3
  2011-04-03  8:36 [ANNOUNCE] Git 1.7.4.3 Junio C Hamano
@ 2011-04-06 18:40 ` Arnaud Lacombe
  2011-04-06 19:58   ` Junio C Hamano
  0 siblings, 1 reply; 6+ messages in thread
From: Arnaud Lacombe @ 2011-04-06 18:40 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

Hi Julio,,

On Sun, Apr 3, 2011 at 4:36 AM, Junio C Hamano <gitster@pobox.com> wrote:
> Junio C Hamano (9):
>      apply: do not patch lines that were already patched
>
This commit introduces a regression when editing splithunks using "git
add -p". Reverting the patch fix the regression.

Considering the following checked-in code:

int
main(int argc, char **argv)
{
        int a;

        return 0;
}

modified the following way:

int
main(int argc, char **argv)
{
        int c;
        int a;
        int d;
        int e;
        int f;

        return 0;
}

if you 'git add -p' on the file, you'll get:

diff --git a/main.c b/main.c
index f9f4197..7fb483f 100644
--- a/main.c
+++ b/main.c
@@ -9,7 +9,11 @@
 int
 main(int argc, char **argv)
 {
+       int c;
        int a;
+       int d;
+       int e;
+       int f;

        return 0;
 }

Now, I only want the first part, so I reduce the context by typing
's', which lead to:

Split into 2 hunks.
@@ -9,4 +9,5 @@
 int
 main(int argc, char **argv)
 {
+       int c;
        int a;

If I edit this hunk and make _no_modification_, "git apply" fails with:

error: patch failed: main.c:12
error: main.c: patch does not apply
Your edited hunk does not apply. Edit again (saying "no" discards!) [y/n]?

This hunk does _apply_, as it could be staged and committed as-is if I
did not edit it.

This was just a way to reproduce the regression. If you change the
code in a way that would still apply, git-apply would still fails to
apply the hunk. Editing the whole original hunk (ie. not split) works
fine.

 - Arnaud

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [ANNOUNCE] Git 1.7.4.3
  2011-04-06 18:40 ` Arnaud Lacombe
@ 2011-04-06 19:58   ` Junio C Hamano
  2011-04-06 20:09     ` "add -p" breakage Junio C Hamano
  0 siblings, 1 reply; 6+ messages in thread
From: Junio C Hamano @ 2011-04-06 19:58 UTC (permalink / raw)
  To: Arnaud Lacombe; +Cc: git

Arnaud Lacombe <lacombar@gmail.com> writes:

> This commit introduces a regression when editing splithunks using "git
> add -p". Reverting the patch fix the regression.

Thanks for a report.  I don't have a time to look at this now; help from
"add -p" people would be appreciated.

I have a suspicion that the symptom may be a bug in "add -p" exposed by
the change; "add -p" which used to count the patch lines carefully itself,
but was modified to use 'apply --recount' in more recent versions.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* "add -p" breakage
  2011-04-06 19:58   ` Junio C Hamano
@ 2011-04-06 20:09     ` Junio C Hamano
  2011-04-06 21:31       ` [PATCH] add--interactive.perl: factor out repeated --recount option Junio C Hamano
  0 siblings, 1 reply; 6+ messages in thread
From: Junio C Hamano @ 2011-04-06 20:09 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Arnaud Lacombe, git

Junio C Hamano <gitster@pobox.com> writes:

> Arnaud Lacombe <lacombar@gmail.com> writes:
>
>> This commit introduces a regression when editing splithunks using "git
>> add -p". Reverting the patch fix the regression.
>
> Thanks for a report.  I don't have a time to look at this now; help from
> "add -p" people would be appreciated.
>
> I have a suspicion that the symptom may be a bug in "add -p" exposed by
> the change; "add -p" which used to count the patch lines carefully itself,
> but was modified to use 'apply --recount' in more recent versions.

Sorry, not that one, but what "add -p" used to carefully do but punts
these days is to combine adjacent hunks correctly.  I suspect that
laziness is coming back and haunt us, and if that is the case, we should
fix it there, and should not work it around by breaking the normal patch
application codepath.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] add--interactive.perl: factor out repeated --recount option
  2011-04-06 20:09     ` "add -p" breakage Junio C Hamano
@ 2011-04-06 21:31       ` Junio C Hamano
  2011-04-06 21:36         ` [PATCH] "add -p": work-around an old laziness that does not coalesce hunks Junio C Hamano
  0 siblings, 1 reply; 6+ messages in thread
From: Junio C Hamano @ 2011-04-06 21:31 UTC (permalink / raw)
  To: git; +Cc: Thomas Rast

Depending on the direction and the target of patch application, we would
need to pass --cached and --reverse to underlying "git apply".  Also we
only pass --check when we are not applying but just checking.

But we always pass --recount since 8cbd431 (git-add--interactive: replace
hunk recounting with apply --recount, 2008-07-02).  Instead of repeating
the same --recount over and over again, move it to a single place that
actually runs the command, namely, "run_git_apply" subroutine.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---

 * Applies on top of 9d15860.  I tried to be careful but may have missed
   some calls.  Extra set of eyeballs appreciated.

 git-add--interactive.perl |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/git-add--interactive.perl b/git-add--interactive.perl
index a329c5a..6a439db 100755
--- a/git-add--interactive.perl
+++ b/git-add--interactive.perl
@@ -705,7 +705,7 @@ sub add_untracked_cmd {
 sub run_git_apply {
 	my $cmd = shift;
 	my $fh;
-	open $fh, '| git ' . $cmd;
+	open $fh, '| git ' . $cmd . " --recount";
 	print $fh @_;
 	return close $fh;
 }
@@ -1050,7 +1050,7 @@ sub edit_hunk_manually {
 
 sub diff_applies {
 	my $fh;
-	return run_git_apply($patch_mode_flavour{APPLY_CHECK} . ' --recount --check',
+	return run_git_apply($patch_mode_flavour{APPLY_CHECK} . ' --check',
 			     map { @{$_->{TEXT}} } @_);
 }
 
@@ -1139,7 +1139,7 @@ sub help_patch_cmd {
 
 sub apply_patch {
 	my $cmd = shift;
-	my $ret = run_git_apply $cmd . ' --recount', @_;
+	my $ret = run_git_apply $cmd, @_;
 	if (!$ret) {
 		print STDERR @_;
 	}
@@ -1148,17 +1148,17 @@ sub apply_patch {
 
 sub apply_patch_for_checkout_commit {
 	my $reverse = shift;
-	my $applies_index = run_git_apply 'apply '.$reverse.' --cached --recount --check', @_;
-	my $applies_worktree = run_git_apply 'apply '.$reverse.' --recount --check', @_;
+	my $applies_index = run_git_apply 'apply '.$reverse.' --cached --check', @_;
+	my $applies_worktree = run_git_apply 'apply '.$reverse.' --check', @_;
 
 	if ($applies_worktree && $applies_index) {
-		run_git_apply 'apply '.$reverse.' --cached --recount', @_;
-		run_git_apply 'apply '.$reverse.' --recount', @_;
+		run_git_apply 'apply '.$reverse.' --cached', @_;
+		run_git_apply 'apply '.$reverse, @_;
 		return 1;
 	} elsif (!$applies_index) {
 		print colored $error_color, "The selected hunks do not apply to the index!\n";
 		if (prompt_yesno "Apply them to the worktree anyway? ") {
-			return run_git_apply 'apply '.$reverse.' --recount', @_;
+			return run_git_apply 'apply '.$reverse, @_;
 		} else {
 			print colored $error_color, "Nothing was applied.\n";
 			return 0;
-- 
1.7.5.rc1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH] "add -p": work-around an old laziness that does not coalesce hunks
  2011-04-06 21:31       ` [PATCH] add--interactive.perl: factor out repeated --recount option Junio C Hamano
@ 2011-04-06 21:36         ` Junio C Hamano
  0 siblings, 0 replies; 6+ messages in thread
From: Junio C Hamano @ 2011-04-06 21:36 UTC (permalink / raw)
  To: git; +Cc: Thomas Rast, Arnaud Lacombe

Since 0beee4c (git-add--interactive: remove hunk coalescing, 2008-07-02),
"git add--interactive" passes overlapping hunks to "git apply" without
coalescing adjacent hunks.  This was partially corrected by 7a26e65 (its
partial revert, 2009-05-16), but overlapping hunks are still passed when
the patch is edited.

Teach the --allow-overlap option to "git apply" to disable the recent
safety feature that avoids misapplication of patches by not applying
patches to overlapping hunks (Cf.  9d15860 (apply: do not patch lines that
were already patched, 2011-03-04), and pass this option from "add -p".

Do not even advertise the option, as this is a workaround; the correct fix
ought to be to make "add -p" correctly coalesce adjacent patch hunks.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 builtin/apply.c           |    9 ++++++---
 git-add--interactive.perl |    2 +-
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/builtin/apply.c b/builtin/apply.c
index 04f56f8..8be1ce5 100644
--- a/builtin/apply.c
+++ b/builtin/apply.c
@@ -43,6 +43,7 @@ static int apply = 1;
 static int apply_in_reverse;
 static int apply_with_reject;
 static int apply_verbosely;
+static int allow_overlap;
 static int no_add;
 static const char *fake_ancestor;
 static int line_termination = '\n';
@@ -2430,9 +2431,9 @@ static void update_image(struct image *img,
 	memcpy(img->line + applied_pos,
 	       postimage->line,
 	       postimage->nr * sizeof(*img->line));
-	for (i = 0; i < postimage->nr; i++)
-		img->line[applied_pos + i].flag |= LINE_PATCHED;
-
+	if (!allow_overlap)
+		for (i = 0; i < postimage->nr; i++)
+			img->line[applied_pos + i].flag |= LINE_PATCHED;
 	img->nr = nr;
 }
 
@@ -3877,6 +3878,8 @@ int cmd_apply(int argc, const char **argv, const char *prefix_)
 			"don't expect at least one line of context"),
 		OPT_BOOLEAN(0, "reject", &apply_with_reject,
 			"leave the rejected hunks in corresponding *.rej files"),
+		OPT_BOOLEAN(0, "allow-overlap", &allow_overlap,
+			"allow overlapping hunks"),
 		OPT__VERBOSE(&apply_verbosely, "be verbose"),
 		OPT_BIT(0, "inaccurate-eof", &options,
 			"tolerate incorrectly detected missing new-line at the end of file",
diff --git a/git-add--interactive.perl b/git-add--interactive.perl
index 6a439db..8de96d9 100755
--- a/git-add--interactive.perl
+++ b/git-add--interactive.perl
@@ -705,7 +705,7 @@ sub add_untracked_cmd {
 sub run_git_apply {
 	my $cmd = shift;
 	my $fh;
-	open $fh, '| git ' . $cmd . " --recount";
+	open $fh, '| git ' . $cmd . " --recount --allow-overlap";
 	print $fh @_;
 	return close $fh;
 }
-- 
1.7.5.rc1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-04-06 21:36 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-03  8:36 [ANNOUNCE] Git 1.7.4.3 Junio C Hamano
2011-04-06 18:40 ` Arnaud Lacombe
2011-04-06 19:58   ` Junio C Hamano
2011-04-06 20:09     ` "add -p" breakage Junio C Hamano
2011-04-06 21:31       ` [PATCH] add--interactive.perl: factor out repeated --recount option Junio C Hamano
2011-04-06 21:36         ` [PATCH] "add -p": work-around an old laziness that does not coalesce hunks Junio C Hamano

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).