Re: [PATCH 1/2] lib-rebase.sh: fake-editor.sh: Allow checking of commit header(s) in $GIT_EDITOR
- From
Jay Soffian <jaysoffian@gmail.com>
- Date
- Jul 13, 2010, 01:39 UTC
- Message-ID
- <AANLkTik7KDM8Vp_nc1NYRZ89cd1IdyfBffq5vUitbrzj@mail.gmail.com>
- In-Reply-To
- <AANLkTin03Ea2fIBQiSDpIqRYLYjWRe9U62nZpfczbfST@mail.gmail.com>
On Mon, Jul 12, 2010 at 8:36 PM, Nazri Ramliy <ayiehere@gmail.com> wrote:
Show 15 quoted lines
> If I were to use a single "sed" invocation here's how it's going to look like: > > sed -e "s/^pick [0-9a-f]\+//" < "$1" > commit_headers.$$ > > But doing so reminds me of this: > > On Sat, Jul 10, 2010 at 6:30 AM, Junio C Hamano <gitster@pobox.com> wrote: >> Nazri Ramliy <ayiehere@gmail.com> writes: >> >>> + sed -i "s/^\([a-z]\+\) [0-9a-f]\+ /\1 $REPLACE_COMMIT_ID /" \ >> >> This is not portable. Escaping an ERE element with a backslash does not >> make it suitable for use in BRE that sed uses. > > Aren't we back to square one? Or am I missing something?
sed 's/^pick [0-9a-f]\{1,\} //'is a valid posix BRE. Alternately + can be expressed as:
sed 's/^pick [0-9a-f][0-9a-f]* //'
Show 9 quoted lines
>>> + diff "$EXPECT_HEADER" commit_headers.$$ > /dev/null >> >> Is "test_cmp" inappropriate here for some reason? > > It seems appropriate, but this will require a ". ./test-lib.sh" from inside > lib-rebase.sh, which fails because at that point we are already in the trash > directory for the test, the solution is to do a ". $TEST_DIRECTORY/test-lib.sh" > instead but that gives more errors due to test-lib.sh assumes that it is always > being "sourced" when $CWD is $TEST_DIRECTORY, i think.
Don't the scripts that source lib-rebase.sh all source test-lib.sh ahead of it? lib-rebase.sh shouldn't need to re-source test-lib.sh. No?
j.