diff options
author | Matthias Sohn <matthias.sohn@gmail.com> | 2021-03-25 16:14:36 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2021-03-25 16:14:36 +0000 |
commit | f4defd75122b93a3d41ceff7396416bd61a9a169 (patch) | |
tree | d46d913a0c7061455b7598043abdc0a1d6427ebd | |
parent | 026829cdc5ff7e6aca0a98316e4edd834cd1d21f (diff) | |
parent | fc974c9022424e5c2751fe64201c11118e3acbc4 (diff) |
Merge "find-duplicate-usernames.sh: add example output of git grep" into stable-3.1
-rwxr-xr-x | contrib/find-duplicate-usernames.sh | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/contrib/find-duplicate-usernames.sh b/contrib/find-duplicate-usernames.sh index f9bcf8810e..aff3ba70c2 100755 --- a/contrib/find-duplicate-usernames.sh +++ b/contrib/find-duplicate-usernames.sh @@ -29,15 +29,22 @@ if [[ "$#" -ne "1" ]] || ! [[ "$1" =~ ^(gerrit|username)$ ]]; then usage fi -# find lines with user name and subsequent line in external-ids notes branch -# remove group separators -# remove line break between user name and accountId lines -# unify separators to ":" -# cut on ":", select username and accountId fields -# sort case-insensitive -# flip columns -# uniq case-insensitive, only show duplicates, avoid comparing first field -# flip columns back +# 1. find lines with user name and subsequent line in external-ids notes branch +# example output of git grep -A1 "\[externalId \"username:" refs/meta/external-ids: +# refs/meta/external-ids:00/1d/abd037e437f71d42134e6ad532a06948a2ba:[externalId "username:johndoe"] +# refs/meta/external-ids:00/1d/abd037e437f71d42134e6ad532a06948a2ba- accountId = 1000815 +# -- +# refs/meta/external-ids:00/1f/0270fc2a6fc3a2439c454c8ab0c75323fdb0:[externalId "username:JohnDoe"] +# refs/meta/external-ids:00/1f/0270fc2a6fc3a2439c454c8ab0c75323fdb0- accountId = 1000816 +# -- +# 2. remove group separators +# 3. remove line break between user name and accountId lines +# 4. unify separators to ":" +# 5. cut on ":", select username and accountId fields +# 6. sort case-insensitive +# 7. flip columns +# 8. uniq case-insensitive, only show duplicates, avoid comparing first field +# 9. flip columns back git grep -A1 "\[externalId \"$1:" refs/meta/external-ids \ | sed -E "/$1/,/accountId/!d" \ | paste -d ' ' - - \ |