summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Sohn <matthias.sohn@sap.com>2021-03-17 09:55:30 +0100
committerMatthias Sohn <matthias.sohn@sap.com>2021-03-24 23:37:46 +0100
commitfc974c9022424e5c2751fe64201c11118e3acbc4 (patch)
treedb0e695c83929deee2ae659012dd0411b47aea4f
parent5c0e72a43827597151544f4abfa1dc0dfa039b6e (diff)
find-duplicate-usernames.sh: add example output of git grep
-rwxr-xr-xcontrib/find-duplicate-usernames.sh25
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 ' ' - - \