<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/git-rebase--interactive.sh, branch v2.0.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.0.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.0.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2014-06-25T18:49:31Z</updated>
<entry>
<title>Merge branch 'rr/rebase-autostash-fix' into maint</title>
<updated>2014-06-25T18:49:31Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2014-06-25T18:49:31Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=d9036cd28c9b115fe38e2f629292f2ddf60fb805'/>
<id>urn:sha1:d9036cd28c9b115fe38e2f629292f2ddf60fb805</id>
<content type='text'>
The autostash mode of "git rebase -i" did not restore the dirty
working tree state if the user aborted the interactive rebase by
emptying the insn sheet.

* rr/rebase-autostash-fix:
  rebase -i: test "Nothing to do" case with autostash
  rebase -i: handle "Nothing to do" case with autostash
</content>
</entry>
<entry>
<title>rebase -i: handle "Nothing to do" case with autostash</title>
<updated>2014-05-19T22:36:24Z</updated>
<author>
<name>Ramkumar Ramachandra</name>
<email>artagnon@gmail.com</email>
</author>
<published>2014-05-19T22:05:20Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=e4244eb3957d478ca05b42d8b56aadb9ab2bc7ae'/>
<id>urn:sha1:e4244eb3957d478ca05b42d8b56aadb9ab2bc7ae</id>
<content type='text'>
When a user invokes

  $ git rebase -i @~3

with dirty files and rebase.autostash turned on, and exits the $EDITOR
with an empty buffer, the autostash fails to apply. Although the primary
focus of rr/rebase-autostash was to get the git-rebase--backend.sh
scripts to return control to git-rebase.sh, it missed this case in
git-rebase--interactive.sh. Since this case is unlike the other cases
which return control for housekeeping, assign it a special return status
and handle that return value explicitly in git-rebase.sh.

Reported-by: Karen Etheridge &lt;ether@cpan.org&gt;
Signed-off-by: Ramkumar Ramachandra &lt;artagnon@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'km/avoid-non-function-return-in-rebase'</title>
<updated>2014-04-21T17:42:46Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2014-04-21T17:42:45Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=0b17b4331087224883878e49342037bf69717b62'/>
<id>urn:sha1:0b17b4331087224883878e49342037bf69717b62</id>
<content type='text'>
Work around /bin/sh that does not like "return" at the top-level
of a file that is dot-sourced from inside a function definition.

* km/avoid-non-function-return-in-rebase:
  Revert "rebase: fix run_specific_rebase's use of "return" on FreeBSD"
  rebase: avoid non-function use of "return" on FreeBSD
</content>
</entry>
<entry>
<title>rebase: avoid non-function use of "return" on FreeBSD</title>
<updated>2014-04-17T17:13:29Z</updated>
<author>
<name>Kyle J. McKay</name>
<email>mackyle@gmail.com</email>
</author>
<published>2014-04-11T08:28:17Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=9f50d32b9c20cc94b9882484ca9704af332a5622'/>
<id>urn:sha1:9f50d32b9c20cc94b9882484ca9704af332a5622</id>
<content type='text'>
Since a1549e10, 15d4bf2e and 01a1e646 (first appearing in v1.8.4)
the git-rebase--*.sh scripts have used a "return" to stop execution
of the dot-sourced file and return to the "dot" command that
dot-sourced it.  The /bin/sh utility on FreeBSD however behaves
poorly under some circumstances when such a "return" is executed.

In particular, if the "dot" command is contained within a function,
then when a "return" is executed by the script it runs (that is not
itself inside a function), control will return from the function
that contains the "dot" command skipping any statements that might
follow the dot command inside that function.  Commit 99855ddf (first
appearing in v1.8.4.1) addresses this by making the "dot" command
the last line in the function.

Unfortunately the FreeBSD /bin/sh may also execute some statements
in the script run by the "dot" command that appear after the
troublesome "return".  The fix in 99855ddf does not address this
problem.

For example, if you have script1.sh with these contents:

run_script2() {
        . "$(dirname -- "$0")/script2.sh"
        _e=$?
        echo only this line should show
        [ $_e -eq 5 ] || echo expected status 5 got $_e
        return 3
}
run_script2
e=$?
[ $e -eq 3 ] || { echo expected status 3 got $e; exit 1; }

And script2.sh with these contents:

if [ 5 -gt 3 ]; then
        return 5
fi
case bad in *)
        echo always shows
esac
echo should not get here
! :

When running script1.sh (e.g. '/bin/sh script1.sh' or './script1.sh'
after making it executable), the expected output from a POSIX shell
is simply the single line:

only this line should show

However, when run using FreeBSD's /bin/sh, the following output
appears instead:

should not get here
expected status 3 got 1

Not only did the lines following the "dot" command in the run_script2
function in script1.sh get skipped, but additional lines in script2.sh
following the "return" got executed -- but not all of them (e.g. the
"echo always shows" line did not run).

These issues can be avoided by not using a top-level "return" in
script2.sh.  If script2.sh is changed to this:

main() {
        if [ 5 -gt 3 ]; then
                return 5
        fi
        case bad in *)
                echo always shows
        esac
        echo should not get here
        ! :
}
main

Then it behaves the same when using FreeBSD's /bin/sh as when using
other more POSIX compliant /bin/sh implementations.

We fix the git-rebase--*.sh scripts in a similar fashion by moving
the top-level code that contains "return" statements into its own
function and then calling that as the last line in the script.

Signed-off-by: Kyle J. McKay &lt;mackyle@gmail.com&gt;
Acked-by: Matthieu Moy &lt;Matthieu.Moy@imag.fr&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'us/printf-not-echo'</title>
<updated>2014-03-25T18:08:27Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2014-03-25T18:08:26Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=cf30bfb8fb9e749637a73685a8de9600ab1fbe5f'/>
<id>urn:sha1:cf30bfb8fb9e749637a73685a8de9600ab1fbe5f</id>
<content type='text'>
* us/printf-not-echo:
  test-lib.sh: do not "echo" caller-supplied strings
  rebase -i: do not "echo" random user-supplied strings
</content>
</entry>
<entry>
<title>rebase -i: do not "echo" random user-supplied strings</title>
<updated>2014-03-17T19:24:14Z</updated>
<author>
<name>Uwe Storbeck</name>
<email>uwe@ibr.ch</email>
</author>
<published>2014-03-14T23:56:43Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=47be06602656ee9cac860f675d2c8d1f0deabdbe'/>
<id>urn:sha1:47be06602656ee9cac860f675d2c8d1f0deabdbe</id>
<content type='text'>
In some places we "echo" a string that comes from a commit log
message, which may have a backslash sequence that is interpreted by
the command (POSIX.1 allows this), most notably "dash"'s built-in
'echo'.

A commit message which contains the string '\n' (or ends with the
string '\c') may result in a garbage line in the todo list of an
interactive rebase which causes the rebase to fail.

To reproduce the behavior (with dash as /bin/sh):

  mkdir test &amp;&amp; cd test &amp;&amp; git init
  echo 1 &gt;foo &amp;&amp; git add foo
  git commit -m"this commit message ends with '\n'"
  echo 2 &gt;foo &amp;&amp; git commit -a --fixup HEAD
  git rebase -i --autosquash --root

Now the editor opens with garbage in line 3 which has to be
removed or the rebase fails.

Signed-off-by: Uwe Storbeck &lt;uwe@ibr.ch&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>rebase: add the --gpg-sign option</title>
<updated>2014-02-11T22:48:20Z</updated>
<author>
<name>Nicolas Vigier</name>
<email>boklm@mars-attacks.org</email>
</author>
<published>2014-02-10T01:03:37Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=3ee5e54038fd32ee60b24ebd385981aeb14b80a5'/>
<id>urn:sha1:3ee5e54038fd32ee60b24ebd385981aeb14b80a5</id>
<content type='text'>
Signed-off-by: Nicolas Vigier &lt;boklm@mars-attacks.org&gt;
Signed-off-by: brian m. carlson &lt;sandals@crustytoothpaste.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>remove #!interpreter line from shell libraries</title>
<updated>2013-11-26T22:23:56Z</updated>
<author>
<name>Jonathan Nieder</name>
<email>jrnieder@gmail.com</email>
</author>
<published>2013-11-25T21:03:52Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=11d62145b904b81013d1ad558d68a74e22e81a91'/>
<id>urn:sha1:11d62145b904b81013d1ad558d68a74e22e81a91</id>
<content type='text'>
In a shell snippet meant to be sourced by other shell scripts, an
opening #! line does more harm than good.

The harm:

 - When the shell library is sourced, the interpreter and options from
   the #! line are not used.  Specifying a particular shell can
   confuse the reader into thinking it is safe for the shell library
   to rely on idiosyncrasies of that shell.

 - Using #! instead of a plain comment drops a helpful visual clue
   that this is a shell library and not a self-contained script.

 - Tools such as lintian can use a #! line to tell when an
   installation script has failed by forgetting to set a script
   executable.  This check does not work if shell libraries also start
   with a #! line.

The good:

 - Text editors notice the #! line and use it for syntax highlighting
   if you try to edit the installed scripts (without ".sh" suffix) in
   place.

The use of the #! for file type detection is not needed because Git's
shell libraries are meant to be edited in source form (with ".sh"
suffix).  Replace the opening #! lines with comments.

This involves tweaking the test harness's valgrind support to find
shell libraries by looking for "# " in the first line instead of "#!"
(see v1.7.6-rc3~7, 2011-06-17).

Suggested by Russ Allbery through lintian.  Thanks to Jeff King and
Clemens Buchacher for further analysis.

Tested by searching for non-executable scripts with #! line:

	find . -name .git -prune -o -type f -not -executable |
	while read file
	do
		read line &lt;"$file"
		case $line in
		'#!'*)
			echo "$file"
			;;
		esac
	done

The only remaining scripts found are templates for shell scripts
(unimplemented.sh, wrap-for-bin.sh) and sample input used in tests
(t/t4034/perl/{pre,post}).

Signed-off-by: Jonathan Nieder &lt;jrnieder@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>rebase -i: respect core.abbrev</title>
<updated>2013-09-30T21:34:50Z</updated>
<author>
<name>Kirill A. Shutemov</name>
<email>kirill.shutemov@linux.intel.com</email>
</author>
<published>2013-09-28T15:53:05Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=568950388be2e47af8bcb0b4a5f02017570b2f33'/>
<id>urn:sha1:568950388be2e47af8bcb0b4a5f02017570b2f33</id>
<content type='text'>
collapse_todo_ids() uses `git rev-parse --short=7' to abbreviate
commit ids before showing them to the user in a text editor.  Let's
drop argument from --short to the configured value instead (still
defaulting to 7).

Signed-off-by: Kirill A. Shutemov &lt;kirill.shutemov@linux.intel.com&gt;
Acked-by: Eric Sunshine &lt;sunshine@sunshineco.com&gt;
Signed-off-by: Jonathan Nieder &lt;jrnieder@gmail.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'es/rebase-i-no-abbrev'</title>
<updated>2013-09-11T22:02:29Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2013-09-11T22:02:29Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=135be1ee2b6cc5b006974e38111990f0e22accd5'/>
<id>urn:sha1:135be1ee2b6cc5b006974e38111990f0e22accd5</id>
<content type='text'>
The commit object names in the insn sheet that was prepared at the
beginning of "rebase -i" session can become ambiguous as the
rebasing progresses and the repository gains more commits. Make
sure the internal record is kept with full 40-hex object names.

* es/rebase-i-no-abbrev:
  rebase -i: fix short SHA-1 collision
  t3404: rebase -i: demonstrate short SHA-1 collision
  t3404: make tests more self-contained
</content>
</entry>
</feed>
