Skip to content

Free, open-source Google Maps scraper for lead generation (Python, no API key, no Docker). Exports name, phone, email, website, rating and Instagram/Facebook/LinkedIn/TikTok/YouTube/X links to CSV. 100 places with emails in 44 s; --grid beats Google's 120 cap. MX email check, ad-pixel detection. Skill for Claude Code, Codex and Cursor.

fix(update): move clones across a rewritten kit history

Mahan Jafarib3f04fab31e2
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index 83ada37..027dbaa 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -15,11 +15,15 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
+ with:
+ fetch-depth: 0 # test_update.sh needs the full history
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- run: python scripts/test_scrape.py
- run: bash -n scripts/scrape.sh
+ - run: bash scripts/test_update.sh
+ shell: bash
- run: python -c "import json; json.load(open('.claude/settings.json'))"
fresh-install:
runs-on: ubuntu-latest
diff --git a/README.md b/README.md
index 11db34f..92d4032 100644
--- a/README.md
+++ b/README.md
@@ -337,7 +337,8 @@ google-maps-scraper-kit/
│ ├── scrape.py Python CLI: single, batch, geocoding, socials, CSV
│ ├── scrape.sh bash CLI: single query
│ ├── update.sh one-command update of a clone or fork
-│ └── test_scrape.py offline tests, no network: python3 scripts/test_scrape.py
+│ ├── test_scrape.py offline tests, no network: python3 scripts/test_scrape.py
+│ └── test_update.sh checks update.sh, no network: bash scripts/test_update.sh
├── docs/ guides and recipes
├── examples/ sample job body and batch keyword list
├── .claude/
diff --git a/scripts/test_update.sh b/scripts/test_update.sh
new file mode 100755
index 0000000..c0a0ae4
--- /dev/null
+++ b/scripts/test_update.sh
@@ -0,0 +1,62 @@
+#!/usr/bin/env bash
+# Checks that scripts/update.sh moves a clone across a rewritten kit history (same files, new
+# commit ids) and leaves copies with their own changes alone. Needs the full git history.
+#
+# bash scripts/test_update.sh
+set -euo pipefail
+
+KIT="$(cd "$(dirname "$0")/.." && pwd -P)"
+T="$(mktemp -d)"
+trap 'rm -rf "$T"' EXIT
+G=(git -c user.name=test -c [email protected] -c init.defaultBranch=master)
+fail() { echo "FAIL: $*"; exit 1; }
+
+# The kit as GitHub has it today, then a clone of it, as a user would have.
+"${G[@]}" init -q --bare "$T/up.git"
+"${G[@]}" -C "$KIT" push -q "$T/up.git" HEAD:refs/heads/master
+"${G[@]}" clone -q -b master "$T/up.git" "$T/user"
+"${G[@]}" -C "$T/user" remote add upstream "$T/up.git"
+"${G[@]}" clone -q -b master "$T/up.git" "$T/own"
+"${G[@]}" -C "$T/own" remote add upstream "$T/up.git"
+echo "my change" >> "$T/own/README.md"
+"${G[@]}" -C "$T/own" commit -q -am "my change"
+
+# Rewrite the kit's history the way the planned clean-up will (drop co-author lines), then
+# publish one more release on top.
+"${G[@]}" clone -q -b master "$T/up.git" "$T/rw"
+(cd "$T/rw" && FILTER_BRANCH_SQUELCH_WARNING=1 "${G[@]}" filter-branch -f \
+ --msg-filter 'sed "/^[Cc]o-[Aa]uthored-[Bb]y:/d"' -- master >/dev/null 2>&1)
+echo "next release" >> "$T/rw/CHANGELOG-test.md"
+"${G[@]}" -C "$T/rw" add CHANGELOG-test.md
+"${G[@]}" -C "$T/rw" commit -q -m "next release"
+"${G[@]}" -C "$T/rw" push -q -f origin master
+NEW_TIP="$(git -C "$T/rw" rev-parse HEAD)"
+git -C "$T/rw" merge-base --is-ancestor fa805c6973ed63caefaceb35d2545d0d682c47aa HEAD 2>/dev/null \
+ && fail "the rewrite kept the old first commit"
+
+# 1. A plain clone moves across and then takes the new release.
+OLD_TIP="$(git -C "$T/user" rev-parse HEAD)"
+out="$(bash "$T/user/scripts/update.sh")" || fail "plain clone: update.sh failed: $out"
+[ "$(git -C "$T/user" rev-parse HEAD)" = "$NEW_TIP" ] || fail "plain clone did not reach the new release"
+[ "$(git -C "$T/user" rev-parse kit-old-history)" = "$OLD_TIP" ] || fail "old history not kept"
+case "$out" in *"moved across"*) ;; *) fail "plain clone: no moved-across message: $out" ;; esac
+
+# 2. A clone with its own commit is left exactly as it was.
+OWN_TIP="$(git -C "$T/own" rev-parse HEAD)"
+if out="$(bash "$T/own/scripts/update.sh")"; then fail "own changes: update.sh should stop"; fi
+[ "$(git -C "$T/own" rev-parse HEAD)" = "$OWN_TIP" ] || fail "own changes: HEAD moved"
+case "$out" in *"your own changes"*) ;; *) fail "own changes: wrong message: $out" ;; esac
+
+# 3. A 'Use this template' copy (no old first commit) keeps the old message and is not touched.
+mkdir "$T/tpl"
+git -C "$KIT" archive HEAD | tar -x -C "$T/tpl"
+"${G[@]}" -C "$T/tpl" init -q
+"${G[@]}" -C "$T/tpl" add -A
+"${G[@]}" -C "$T/tpl" commit -q -m "Initial commit"
+"${G[@]}" -C "$T/tpl" remote add upstream "$T/up.git"
+TPL_TIP="$(git -C "$T/tpl" rev-parse HEAD)"
+if out="$(bash "$T/tpl/scripts/update.sh")"; then fail "template copy: update.sh should stop"; fi
+[ "$(git -C "$T/tpl" rev-parse HEAD)" = "$TPL_TIP" ] || fail "template copy: HEAD moved"
+case "$out" in *"Use this template"*) ;; *) fail "template copy: wrong message: $out" ;; esac
+
+echo "OK: update.sh handles a rewritten history"
diff --git a/scripts/update.sh b/scripts/update.sh
index f99ee07..3cc553b 100755
--- a/scripts/update.sh
+++ b/scripts/update.sh
@@ -28,11 +28,35 @@ fi
git remote get-url upstream >/dev/null 2>&1 || git remote add upstream "$UPSTREAM"
git fetch --quiet upstream "$BRANCH"
+# The kit's history may be rewritten once to tidy commit credits: every commit gets a new id but
+# keeps exactly the same files. A clone of the old history (it contains the old first commit)
+# whose files match a kit version moves across to the new history; nothing on disk changes.
+OLD_ROOT="fa805c6973ed63caefaceb35d2545d0d682c47aa"
+MOVED=""
if ! git merge-base HEAD "upstream/$BRANCH" >/dev/null; then
- echo "This copy shares no history with the original (it was made with 'Use this template',"
- echo "or it is a shallow clone), so git can't merge updates into it."
- echo "See what changed: https://github.com/Mahanaicoach/google-maps-scraper-kit/commits/$BRANCH"
- exit 1
+ if git merge-base --is-ancestor "$OLD_ROOT" HEAD 2>/dev/null; then
+ TREE="$(git rev-parse 'HEAD^{tree}')"
+ MATCH="$(git log --format='%H %T' "upstream/$BRANCH" | awk -v t="$TREE" '$2 == t && !m { m = $1 } END { print m }')"
+ if [ -z "$MATCH" ]; then
+ echo "The kit's history was rewritten on GitHub, and this copy has your own changes, so it"
+ echo "can't move across by itself. Nothing was changed. Clone the kit again, then copy your"
+ echo "changes into it: git clone $UPSTREAM"
+ exit 1
+ fi
+ git branch -f kit-old-history HEAD
+ git reset --quiet --hard "$MATCH"
+ MOVED=1
+ echo "The kit's history was rewritten on GitHub; this copy moved across (your files are unchanged)."
+ echo "The old history is kept in the branch kit-old-history."
+ if ! git remote get-url origin 2>/dev/null | grep -qi "mahanaicoach/google-maps-scraper-kit"; then
+ echo "Your fork on GitHub still has the old history. Update it with: git push --force origin HEAD:$BRANCH"
+ fi
+ else
+ echo "This copy shares no history with the original (it was made with 'Use this template',"
+ echo "or it is a shallow clone), so git can't merge updates into it."
+ echo "See what changed: https://github.com/Mahanaicoach/google-maps-scraper-kit/commits/$BRANCH"
+ exit 1
+ fi
fi
BEFORE="$(git rev-parse HEAD)"
@@ -49,7 +73,7 @@ if [ "$BEFORE" = "$(git rev-parse HEAD)" ]; then
else
echo "Updated. What's new:"
git log --oneline --no-merges -n 20 "$BEFORE..HEAD"
- if ! git remote get-url origin 2>/dev/null | grep -qi "mahanaicoach/google-maps-scraper-kit"; then
+ if [ -z "$MOVED" ] && ! git remote get-url origin 2>/dev/null | grep -qi "mahanaicoach/google-maps-scraper-kit"; then
echo "Your fork on GitHub is still on the old version. Run 'git push' to update it too."
fi
fi