Re: [PATCH v2 4/4] buitin-status: Add tests for submodule summary

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Mar 14, 2008 at 2:04 AM, Junio C Hamano <gitster@xxxxxxxxx> wrote:
> Johannes Sixt <j.sixt@xxxxxxxxxxxxx> writes:
>
>  > Ping Yin schrieb:
>  >> +cd sm &&
>  >> +head=$(git rev-parse --verify HEAD | cut -c1-7) &&
>  >> +cd ..
>  >
>  > I think you can make these three lines into:
>  >
>  > test_expect_success 'get short SHA1 of submodule HEAD' '
>  >
>  >       head=$(cd sm && git rev-parse --verify HEAD | cut -c1-7)
>  > '
>
>  "git rev-parse --short=12 --verify HEAD" or whatever minimum length you
>  would want would free you from an ugly "pipe to cut".
>
Thanks.

diff --git a/t/t7502-status.sh b/t/t7502-status.sh
index 7a9a08f..80e2a7b 100755
--- a/t/t7502-status.sh
+++ b/t/t7502-status.sh
@@ -187,9 +187,7 @@ test_expect_success
        git diff expect output
 '

-cd sm &&
-head=$(git rev-parse --verify HEAD | cut -c1-7) &&
-cd ..
+head=$(cd sm && git rev-parse --short=7 --verify HEAD)

 cat > expect <<EOF
 # On branch master



-- 
Ping Yin
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux