1 .
I think line numbers are a useful way to specify a snippet. The wiki editor should use them with an unchanging commit (otherwise the file contents change)
First case: One idea is that we don't update these snippets as they are coming from a fixed commit (not from master) hence we don't need any update mechanism for these types of cases.
Second case: If we need to update them as this is the motto of the project then I am not sure how to find a simple and safe solution to update such snippets. I tried to use one in my previous project proposal as:
Idea is to maintain a mapping/database of source (git-doc), destination (wiki-page), commit-id (from which the content is taken), start line number (The start line number from where the content was pulled) and end line number (The end line number till where content was pulled). After any commit in the corresponding file, check the difference between the content of git-doc between the start line and end line of commit-id (saved in mapping) and the content of git-doc between start line and end line patterns in the most recent commit.
( Why patterns? : It might be the case that start line and end line numbers get modified after the most recent commit. By comparing the content using the line numbers might give a false information. Hence, the solution is to search for the pattern, which are present at git-doc' start line and at end line (for the saved commit-id in mapping), in the most recent commit.)
If a difference is reported by above comparison then previously saved commit-id, start line and end line will be replaced by present commit-id, start line and end line number.
But it uses a database and a complex approach.
Which one is good to proceed with?
2 .
Your step 2.
Idea is to maintain a mapping/database of source (git-doc) and destination (wiki-page) and adding a post commit hook which triggers the update remotely from Jenkins.
is interesting. If the wikipage is pulling in HEAD, then depending on caching the page will remain the same even when git updates. I don't know how much caching the parser cache and page cache do. If it's only cached for a day or so and editors can force new contents with ?action=purge, then maybe we don't need this complicated dependency handling.