{"kind":1640,"pubkey":"573634b648634cbad10f2451776089ea21090d9407f715e83c577b4611ae6edc","created_at":1772296288,"tags":[["author","Silberengel","silberengel7@protonmail.com"],["message","administer the repos"]],"content":"Signed commit: administer the repos","id":"8825fb9bd01e099c1369f0c9ea1429dedd0a0116d103b4a640752c0a830fbc61","sig":"676f0817f817204ad910a70540399f71743a54453ae209535dcb30356d042b049138d9cfdeec08c4b7da03bb6bb51c71477bbf8d2f58bd4b602b9f69af4b3405"}
// Get default branch from preferred branch, git config, environment, or use 'master'
// Check preferred branch first (from user settings), then git's init.defaultBranch config
@ -291,22 +296,56 @@ You can use this read-me file to explain the purpose of this repo to everyone wh
@@ -291,22 +296,56 @@ You can use this read-me file to explain the purpose of this repo to everyone wh
logger.info({npub,repoName,defaultBranch,workDir},'Worktree created successfully');
}
// Write README.md
constreadmePath=join(workDir,'README.md');
@ -335,19 +374,35 @@ Your commits will all be signed by your Nostr keys and saved to the event files
@@ -335,19 +374,35 @@ Your commits will all be signed by your Nostr keys and saved to the event files
logger.warn({repoPath,npub,repoName,error: configError},'Failed to set git config, commit may fail');
}
// Commit files together
awaitworkGit.commit('Initial commit',filesToAdd,{
// Commit files together with "Initial commit to GitRepublic" message
// This will be the first and only commit on the branch
awaitworkGit.commit('Initial commit to GitRepublic',filesToAdd,{
logger.warn({error: cleanupErr,workDir,repoPath},'Failed to clean up worktree (non-critical)');
}
}
}
}
@ -513,14 +568,23 @@ Your commits will all be signed by your Nostr keys and saved to the event files
@@ -513,14 +568,23 @@ Your commits will all be signed by your Nostr keys and saved to the event files
@ -530,7 +594,6 @@ Your commits will all be signed by your Nostr keys and saved to the event files
@@ -530,7 +594,6 @@ Your commits will all be signed by your Nostr keys and saved to the event files
if(announcementToUse){
// Save announcement to repo asynchronously (non-blocking)
// We have the announcement from relays, so this is just for offline papertrail
@ -539,8 +602,36 @@ Your commits will all be signed by your Nostr keys and saved to the event files
@@ -539,8 +602,36 @@ Your commits will all be signed by your Nostr keys and saved to the event files
logger.warn({error: rmErr,npub,repoName},'Failed to remove empty repository, will try to fetch into it');
// Continue - might be able to fetch into existing empty repo
}
// Fall through to fetch from remotes below
}
}catch(err){
// Error checking commits - assume empty and try to fetch
logger.warn({error: err,npub,repoName},'Error checking if repo has commits, will try to fetch from remotes');
// Try to remove and clone fresh
try{
const{rmSync}=awaitimport('fs');
rmSync(repoPath,{recursive: true,force: true});
logger.info({npub,repoName},'Removed repository directory after error checking commits');
}catch(rmErr){
logger.warn({error: rmErr,npub,repoName},'Failed to remove repository after error');
}
// Fall through to fetch from remotes below
}
// Repo exists but is empty - continue to fetch from remotes below
}
// If no announcement provided, try to fetch from relays
@ -778,13 +869,92 @@ Your commits will all be signed by your Nostr keys and saved to the event files
@@ -778,13 +869,92 @@ Your commits will all be signed by your Nostr keys and saved to the event files
thrownewError('Repository clone completed but repository path does not exist');
}
// Ensure announcement is saved to nostr/repo-events.jsonl (non-blocking - repo is usable without it)
// Fire and forget - we have the announcement from relays, so this is just for offline papertrail