From patchwork Tue Jan 14 15:21:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?zqPPhM6xz43Pgc6/z4Igzp3PhM6tzr3PhM6/z4I=?= X-Patchwork-Id: 11332511 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C64DC92A for ; Tue, 14 Jan 2020 15:21:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A34362072B for ; Tue, 14 Jan 2020 15:21:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="HAj9SK1m" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728935AbgANPV5 (ORCPT ); Tue, 14 Jan 2020 10:21:57 -0500 Received: from mail-ot1-f67.google.com ([209.85.210.67]:36522 "EHLO mail-ot1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726839AbgANPV5 (ORCPT ); Tue, 14 Jan 2020 10:21:57 -0500 Received: by mail-ot1-f67.google.com with SMTP id m2so8093050otq.3 for ; Tue, 14 Jan 2020 07:21:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to :content-transfer-encoding; bh=j6iR43TQnAGKyeV6kAwVnqcu5FtJPvjwDdylNWuWarg=; b=HAj9SK1mLN/WwpCSGWKfik+/aeGpxDa+cK5j8xSLmHaV79jKrJtqg9AUQLN1fgLD7M ddsOHXJZTLK/V1ihDJTLUCJXSLUW6jRi7IYvIpkYRZj2+PFEsbP8PuIvVQTz11/+SG12 qlyeX4Erpe5fFop/6FqKzpePlIn5wcBT+GPWgGd+0TA+W+FzeOsC4oginQ4y84TApTZz w2vNrPulARCdI936a8zMZOfmCB7yMtOb8ZfC/pOX0yHzdvKri7rcrD3xKMf5SZJ3rCns ocyXne281vaCO/qZwjCKfLUlDOOhNaVbjHTJCpN7drgJWzaL4C2S91ItwdX4Cm+QdF/c EGkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to :content-transfer-encoding; bh=j6iR43TQnAGKyeV6kAwVnqcu5FtJPvjwDdylNWuWarg=; b=BL2ucxUP+fxGzI+Wh2ocw0u3XgLrWqg5H4RuSMfs3/uyd5dJ2OCr2PQZzgdCqXPB0P XTpsFOhEZZj8SbJx3DYPWGWhzbPrxen1v8XrYVSOLocvevKM7X0xAkSjXAjzZ5k0+OLf HuNJ09E2gWC69N4v8UHvgP04kKczYXPCh1TkpO1s5AfaPZHd8eR2fuHeLx8eIr9EDc8D qlqi3cLQv6jLLmxcmIUsvlbC8En7u9HngOmbu/+ZbbbtwrCgf4UpCZhsNywY1wrWPb3T l2kTuTfoGsmyEKDclSj/zTFL0y16PBUkAvTNXM4ZUMrLZWk0FJJmCNv7TPUSiTCpwD97 F5/g== X-Gm-Message-State: APjAAAU07dS27FH8HOJhrcYrsriK+c5fZ0CoqCbSPBExV09n1jeHb8vm 4/dol4wEAV6vJFbVAcHndlJTCLAobnEhETn/R6bj5WBFes0= X-Google-Smtp-Source: APXvYqzbbDtHsatZ0pZ+4qwQAT2OOCWsU9i3sia1llJpNd6ANbp5hShF6WTB5/PdnSQqXJK9eedM2PA/+s5yWg5K3os= X-Received: by 2002:a9d:7357:: with SMTP id l23mr16397168otk.10.1579015316176; Tue, 14 Jan 2020 07:21:56 -0800 (PST) MIME-Version: 1.0 From: =?utf-8?b?zqPPhM6xz43Pgc6/z4Igzp3PhM6tzr3PhM6/z4I=?= Date: Tue, 14 Jan 2020 17:21:20 +0200 Message-ID: Subject: Git alias syntax help To: git Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Hello there, I am having an issue with git-aliases - specifically, the intricacies involved in their syntax. In general, the syntax is confusing to me, especially when it is _wise_ to use quotes inside a `!sh` alias. e.g. which one would be the correct one new = "!f() { : git log ; git log \"${1}@{1}..${1}@{0}\" \"$@\" ; } ; f" new = !f() { : git log ; git log "${1}@{1}..${1}@{0}" "$@" ; } ; f (from converting this: https://git.wiki.kernel.org/index.php/Aliases#What.27s_new.3F) new = !sh -c 'git log $1@{1}..$1@{0} "$@"' The alias confusing me is more specifically this: https://git.wiki.kernel.org/index.php/Aliases#simple_diff_ignoring_line_number_changes diffsort = !sh -c 'git diff "$@" | grep "^[+-]" | sort --key=1.2 | uniq -u -s1' The output of: $ colordiff -su <(git diffsort HEAD^..HEAD) <(git diffsort HEAD^^..HEAD^) Files /dev/fd/63 and /dev/fd/62 are identical is a little unexpected, since I know for a fact that one of the referced commits is not a code block moved. (and indeed, if I do it myself: $ colordiff -su <(git diff HEAD^..HEAD | grep "^[+-]" | sort --key=1.2 | uniq -u -s1) <(git diff HEAD^^..HEAD^ | grep "^[+-]" | sort --key=1.2 | uniq -u -s1) I would appreciate if someone would clear out the air for me. I think I have done my homework enough, and it is not trivially obvious what is the correct thing to do. I'll gladly take pointers though Ντέντος Σταύρος --- /dev/fd/63 2020-01-14 17:17:45.103771745 +0200 +++ /dev/fd/62 2020-01-14 17:17:45.103771745 +0200 @@ -1,2 +1,13 @@ [....] it works. The issue I have found is: $@ is not expanded Tested with: diffsort = !sh -c 'echo "+git diff $@" | grep "^[+-]" | sort --key=1.2 | uniq -u -s1' $ git diffsort HEAD^..HEAD +git diff